<image>

Input

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

Output

Output a single integer.

Example

Input


3


Output


13
import java.util.*;
import java.math.*;
import java.io.*;

public class CF1145C {
	public CF1145C() {
		FS scan = new FS();
		int x = scan.nextInt();
		if(x == 0) System.out.println(15); // this is right
		if(x == 1) System.out.println(14); // this is right
		if(x == 2) System.out.println(12); // this is right
		if(x == 3) System.out.println(13); // this is right
		if(x == 4) System.out.println(8); // this is right
		if(x == 5) System.out.println(9); // this is right
		if(x == 6) System.out.println(10);
		if(x == 7) System.out.println(11);
		if(x == 8) System.out.println(0);
		if(x == 9) System.out.println(1);
		if(x == 10) System.out.println(2);
		if(x == 11) System.out.println(3);
		if(x == 12) System.out.println(4);
		if(x == 13) System.out.println(5);
		if(x == 14) System.out.println(6);
		if(x == 15) System.out.println(7);
//		for(int x = 0 ; x < 16 ; x++) {
//			int mask = 0;
//			if((x & 1) == 0) mask |= 0b1111;
//			if((x & 0b1110) != 0b1110) mask |= 0b1110;
//			System.out.printf("%d -> %d%n", x, x ^ mask);
//		}
//		for(int x = 0 ; x < 16 ; x++) {
//			int mask = 0;
//			if((x & 1) == 0) mask |= 1;
//			if((x & 0b1110) != 0b1110) mask |= 0b1110;
//			System.out.printf("%d -> %d%n", x, x ^ mask);
//		}
//		int x = scan.nextInt();
////		x = ((x << 2) + 1) % 16;
////		System.out.println(x);
////		System.out.println(16 - x);
//		int mask = 0;
//		if((x & 1) == 0) mask |= 0b1111;
//		if((x & 0b1110) != 0b1110) mask |= 0b1110;
//		System.out.println(x ^ mask);
////		System.out.println(Integer.toHexString(x));
	}
	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		public String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) { e.printStackTrace(); }
			}
			return st.nextToken();
		}
		public int nextInt() { return Integer.parseInt(next()); }
	}
	public static void main(String[] args) { new CF1145C(); }
}
