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.*;
import java.io.*;
import java.math.*;
public class cf
{
    static int n;
    static int arr[];
    public static void main(String args[])throws IOException
    {
        PrintWriter out=new PrintWriter(System.out);
        Reader sc=new Reader();
        int a=sc.nextInt();
        int arr[]={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,654,663,666,690,706,728,729};
        out.println(arr[a-1]);
        out.flush();
    }
    
    
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE];bufferPointer = bytesRead = 0;
        }
        public int nextInt() throws IOException
        {
            int ret = 0;byte c = read();
            while (c <= ' ')c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do{ret = ret * 10 + c - '0';}  while ((c = read()) >= '0' && c <= '9');
            if (neg)return -ret;
            return ret;
        }
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
    }
}