'''
解题思路:
1、关键是1~3位数的表达,首先考虑1~19,20、30、……90建立字典
2、然后将1~3位填充成3位,再分别考虑每一位是否为0的情况
3、and的位置:百位数个数基数词形式加“hundred”,表示几百,在几十几与百位间加上and
例如:2,648 two thousand six hundred and forty eight
'''
D = {'1':'one','2':'two','3':'three','4':'four','5':'five',
'6':'six','7':'seven','8':'eight','9':'nine','10':'ten',
'11':'eleven','12':'twelve','13':'thirteen','14':'fourteen',
'15':'fifteen','16':'sixteen','17':'seventeen','18':'eighteen',
'19':'nineteen','20':'twenty','30':'thirty','40':'forty',
'50':'fifty','60':'sixty','70':'seventy','80':'eighty','90':'ninety'}
def f3(L):
L = L.zfill(3)
t = str(int(L))
out = ''
if t in D:
return D[t]
else:
if L[0] != '0' and int(L[1:]) == 0: # 100
out += D[L[0]]+' hundred'
if L[0] != '0' and int(L[1:]) != 0: # 101、121、120
#---------------------------------------------------------------
# 只有百和十之间有and
out += D[L[0]]+' hundred and '
if L[1] != '0' and L[2] != '0': # 11*、12*
if int(L[1:])>=10 and int(L[1:])<=20: # 110~120
out += D[L[1:]]
else:
out += D[L[1]+'0'] + ' ' + D[L[2]] # 125、135、146
if L[1] == '0' and L[2] != '0': # 101、102、103
out += D[L[2]]
if L[1] != '0' and L[2] == '0': # 110、120、130
out += D[L[1:]]
return out
def f9(L):
L = L.zfill(9)
L1 = L[:3]
L2 = L[3:6]
L3 = L[6:9]
out = ''
if int(L1)>0:
out += f3(L1)+' million '
if int(L2)>0:
out += f3(L2)+' thousand '
if int(L3)>0:
out += f3(L3)
return out
while 1:
try:
pass
L = input()
if len(L)<=9 and int(L)>0 and L.isdigit():
print(f9(L))
else:
print('error')
except:
break