<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 MysteryCircuit {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int n = s.nextInt();
        int n2 =0;
        int i=3;
        while(n>0){
            int b = (n&1);
            n2=n2+(b<<i);
            i--;
            n=n>>1;
        }
    //    System.out.println(n2);
        if(n2==0){
            n2=16;
        }
        n2=n2-1;
        int n3=0;
        i=3;
        while(n2>0){
            int b = (n2&1);
            n3=n3+(b<<i);
            i--;
            n2=n2>>1;
        }
        System.out.println(n3);
    }
}