<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.Scanner;

public class MystryCircuit {
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		int n,i=0,dec=0,rem;
		int[] a=new int[5];
		int[] b= {1,1,1,1};
		
		Scanner scanner=new Scanner(System.in);
		
		n=scanner.nextInt();
		
		while(i<4) {
		    rem=n%2;
			n=n/2;
			a[i]=rem;
			i++;
		}
		
		for(i=0;i<=3;i++) {
			if(a[i]==1) dec=dec+(int) Math.pow(2, 3-i);
		}
		
		//System.out.println(dec);
		
		if((dec+15)>15) dec=dec-1;
		else dec=dec+15;
		
		//System.out.println(dec);
		
		i=0;
		
		while(i<4) {
			 rem=dec%2;
			dec=dec/2;
			a[i]=rem;
			i++;
		}
		
		dec=0;
		
		for(i=0;i<=3;i++) {
			if(a[i]==1) dec=dec+(int) Math.pow(2, 3-i);
		}
		
		System.out.println(dec);

	}

}
