<image>

Input

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

Output

Output a single integer.

Example

Input


3


Output


13
import sys

x = int(raw_input())

# 7
# 6


if x == 3:
  print 13
  sys.exit(0)
if x == 0:
  print 15
  sys.exit(0)
if x == 1:
  print 14
  sys.exit(0)
if x == 2:
  print 12
  sys.exit(0)
if x == 4:
  print 8
  sys.exit(0)
if x == 5:
  print 9
  sys.exit(0)
if x == 6:
  print 10
  sys.exit(0)
if x == 7:
  print 11
  sys.exit(0)
if x == 8:
  print 0
  sys.exit(0)
if x == 9:
  print 1
  sys.exit(0)
if x == 10:
  print 2
  sys.exit(0)
if x == 11:
  print 3
  sys.exit(0)
if x == 12:
  print 4
  sys.exit(0)
if x == 13:
  print 5
  sys.exit(0)
if x == 14:
  print 6
  sys.exit(0)
if x == 15:
  print 7
  sys.exit(0)


b = [(1 if (1<<i)&x else 0) for i in xrange(4)]
c = [(1 if (b[i]^1) else 0) for i in xrange(4)][1:]
b = [0 if (b[0]^b[1]) else 1] + c
b = [str(i) for i in b[::-1]]
print int("".join(b), 2)
