#n=input()
#n=int(n)
#c=n%10*10
#d=n//10
#e=(c+d)*2-100
#f=(c+d)*2
#if e>50:
# print(e)
# print('OH MY GOD')
#elif f>100:
# print(e)
# print('GOOD')
# print(f)
# print('GOOD')
#n=input()
#n=int(n)
#a=n>0
#b=n<0
#c= n==0
#if a:
# print('양수')
#elif b:
# print('음수')
#elif c:
# print('0')
n=input()
n=int(n)
a=n%10
b=n%10
c=n%10
d=n//10
if a==1:
print(n,'st', sep='')
elif b==2:
print(n,'nd', sep='')
elif c==3:
print(n,'rd', sep='')
elif d==1:
print(n,'th', sep='')
else :
print(n,'th', sep='')



