n = int(input())
if n>=3 and n<6:
for i in range(10**(n-1),10**n):
sum=0
for j in map(int,str(i)):
sum=sum+j**n
if sum==i:
print(i)
'''
#参考答案
def Narcissistic(n):
sum = 0
for i in map(int, str(n)):
sum = sum + i ** len((str(n)))
if sum == int(n):
return True
else:
return False
n = int(input()) #输出指定位数的水仙花数
for i in range(10**(n-1),10**n):
if Narcissistic(i):
print(i)
'''