5027 in words is written as :

Five Thousand Twenty Seven