<image>

Input

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

Output

Output a single integer.

Example

Input


3


Output


13
n = int(input())
b = list(bin(n).split('b')[1])
l1 = list(['0']*(4-len(b))+b)
x = int(''.join(reversed(l1)),2)-1
if x < 0:
    x = 15
y = list(bin(x).split('b')[1])
l2 = list(['0']*(4-len(y))+y)
print(int(''.join(reversed(l2)), 2))