Problem: 

Input

The input contains a single integer a (0 ≤ a ≤ 35).

Output

Output a single integer.

Examples

Input

3


Output

8


Input

10


Output

1024

Solution (in PYTHON3):

Solution:
n=int(input())
sieve=[]
for i in range(10001):
	sieve.append(1)
sieve[0]=sieve[1]=0
for i in range(2,10000):
	j=2
	while i*j<=10000:
		sieve[i*j]=0
		j+=1
def sumdig(x):
	ans=0
	for i in x:
		ans+=int(i)
	return ans
def primeFactors(x):
	pf=[]
	for i in range(2,x//2+1):
		while sieve[i]==1 and x%i==0:
			x//=i
			pf.append(i)
	return pf
value=4
while True:
	compareWith=sumdig(str(value))
	pf=primeFactors(value)
	compareWhom=0
	for i in pf:
		compareWhom+=sumdig(str(i))
	if compareWhom==compareWith:
		n-=1
	if n==0:
		print(value)
		exit(0)
	value+=1