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

public class MysteryCircuit{


    static int flippAndGetBit(int i, int n) {
        return (~((1<<i) & n)) & (1<<i);
    }

    static int clearBit(int i, int n) {
        return n & ~(1<<i);
    }

    static boolean getBit(int i, int n) {
        return ((n & (1<<i)) != 0);
    }

    static boolean checkTrueState(int i, int n) {
        for (int j = i+1; j <= 3; j++) {
            if(!getBit(j, n)) {
                return false;
            }
        }
        return true;
    }


    static int flippIfTrue(int i, int n) {
        if(checkTrueState(i, n)) {
            return flippAndGetBit(i, n) | clearBit(i, n);
        }
        return n;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for(int i=3; i>=0; i--) {
            n = flippIfTrue(i, n);
        }
        System.out.println(n);
    }
}