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:
/**
 * Created by mo on 3/31/17.
 */

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

/**
 * 3 -> 27
 * 1 -> 4
 * 2 -> 22
 */
public class NumbersJoke {
    static StringBuilder sb;

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        if (n == 1)
            System.out.println(4);
        if (n == 2)
            System.out.println(22);
        if (n == 3)
            System.out.println(27);
        if (n == 4)
            System.out.println(58);
        if (n == 5)
            System.out.println(85);
        if (n == 6)
            System.out.println(94);
        if (n == 7)
            System.out.println(121);
        if (n == 8)
            System.out.println(166);
        if (n == 9)
            System.out.println(202);
        if (n == 10)
            System.out.println(265);
        if (n == 11)
            System.out.println(274);
        if (n == 12)
            System.out.println(319);
        if (n == 13)
            System.out.println(346);
        if (n == 14)
            System.out.println(355);
        if (n == 15)
            System.out.println(378);
        if (n == 16)
            System.out.println(382);
        if (n == 17)
            System.out.println(391);
        if (n == 18)
            System.out.println(438);
        if (n == 19)
            System.out.println(454);
        if (n == 20)
            System.out.println(483);
        if (n == 21)
            System.out.println(517);
        if (n == 22)
            System.out.println(526);
        if (n == 23)
            System.out.println(535);
        if (n == 24)
            System.out.println(562);
        if (n == 25)
            System.out.println(576);
        if (n == 26)
            System.out.println(588);
        if (n == 27)
            System.out.println(627);
        if (n == 28)
            System.out.println(634);
        if (n == 29)
            System.out.println(636);
        if (n == 30)
            System.out.println(645);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }

        long[] readLongArray(int n) {
            long[] a = new long[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextLong();
            }
            return a;
        }
    }
}