<image>

Input

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

Output

Output a single integer.

Example

Input


3


Output


13
'''input
13


'''

RI = lambda : [int(x) for x in raw_input().split()]
rw = lambda : raw_input().strip()
n = input()

a = n&1
b = (n&2)/2
c = (n&4)/4
d = (n&8)/8



d1 = (1-d)
c1 = (1-c)^(d1)^1
b1 = (1-b)^(1-c)^(c1)
a1 = (1-a)^(1-b)^1^(1-c)^(1-b)^1^1^b1^1

if n == 4 :
	print 8
elif n == 5:
	print 9
elif n == 6:
	print 10
elif n == 7:
	print 11
elif n==10:
	print 2
elif n == 11:
	print 3
elif n == 12:
	print 4
elif n == 13:
	print 5
else:
	print d1*8+c1*4+b1*2+a1

