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.*;
public class NumbersJoke {

	public static void main(String[] args) {
		// TODO Aut	o-generated method stub
		Scanner in =  new Scanner(System.in) ; 
		int num  = in.nextInt()  ; 
		int a[] = new int [10000] ; 
		int j = 0 ; 
		
		 for(int i = 1 ; i<1000 ; i++){
			 if(isTrue(i) && !isPrime(i)){
				 a[j] = i ;
				 j++ ; 
			 }
		 }
		 System.out.println(a[num -1 ]);
		 
		
	}
	 static int sumPrimeFact(int n)
	    {
	        int i=2, sum=0;
	        while(n>1)
	        {
	            if(n%i==0)
	            {
	                sum=sum+sumOfDigits(i);
	                n=n/i;
	            }
	            else
	                i++;
	        }
	        return sum;
	    }
	
	 static int sumOfDigits(int n ){
		 int sum = 0 ; 
		 while(n!= 0 ){
			 sum += n%10 ; 
			 n/=10 ; 	 
		 }
		 return sum ; 
		 
			 
	 }
	 static  boolean isTrue(int n ){
		  if(sumOfDigits(n) == sumPrimeFact(n))
			  return true ; 
		  else 
			 return false ; 
		  
	 }
	 static boolean isPrime(int num) {
	        if (num < 2) return false;
	        if (num == 2) return true;
	        if (num % 2 == 0) return false;
	        for (int i = 3; i * i <= num; i += 2)
	            if (num % i == 0) return false;
	        return true;
	}
	
}