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.io.*;
import java.util.*;

public class Main {

    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int[] a = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648};
            out.println(a[in.nextInt()-1]);
        }
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Task task = new Task();
        task.solve(in, out);
        out.close();
    }

    public static class InputReader{
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        InputReader(InputStream inputStream){
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 32768);
            stringTokenizer = null;
        }

        public String next(){
            while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()){
                try{
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }catch (Exception e){}
            }
            return stringTokenizer.nextToken();
        }

        public String nextLine() throws IOException{
            return bufferedReader.readLine();
        }

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

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

        public float nextFloat(){
            return Float.parseFloat(next());
        }

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