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 JAVA):

Solution:
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class MysteryCircuit {
	
	public static int[] convertBinary(int num){
	    int binary[] = new int[4];
	    int index = 0;
	    while(num > 0){
	      binary[index++] = num%2;
	      num = num/2;
	    }
	    return binary;
	}
	
	public static int[] reverse(int[] a) {
		int[] b = new int[a.length];
		for(int i = 0; i < a.length; i++) b[i] = a[a.length-i-1];
		return b;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int[] xBi = convertBinary(x);
		//System.out.println(Arrays.toString(xBi));
		if(xBi[3]==1)xBi[3] = 0;
		else if(xBi[2] == 1) {
			xBi[3] = 1;
			xBi[2] = 0;
		}else if(xBi[1] == 1) {
			xBi[3] = 1;
			xBi[2] = 1;
			xBi[1] = 0;
		}else if(xBi[0] == 1){
			xBi[3] = 1;
			xBi[2] = 1;
			xBi[1] = 1;
			xBi[0] = 0;
			
		} else {
			Arrays.fill(xBi, 1);
		}
		xBi = reverse(xBi);
		int out = 0;
		for(int i = 0; i < xBi.length; i++) {
			out += xBi[xBi.length-i-1] * Math.pow(2, i);
		}
		//System.out.println(Arrays.toString(xBi));
		System.out.println(out);
	}
}