Problem:
Score : 100 points

Problem Statement

Print the K-th element of the following sequence of length 32:

1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51

Constraints

1 \leq K \leq 32

All values in input are integers.

Input

Input is given from Standard Input in the following format:

K

Output

Print the K-th element.

Sample Input 1

6

Sample Output 1

2

The 6-th element is 2.

Sample Input 2

27

Sample Output 2

5

The 27-th element is 5.

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Runtime Error)

import java.math.BigInteger;
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int h1 = sc.nextInt();
        int w1 = sc.nextInt();
        BigInteger h = BigInteger.valueOf(h1);
        BigInteger w = BigInteger.valueOf(w1);
        BigInteger ans = BigInteger.valueOf(0);

        if(h == BigInteger.valueOf(1)){
            ans = BigInteger.valueOf(1);
        }

        else if(h.remainder(BigInteger.valueOf(2)) != BigInteger.valueOf(0)){
            ans = ((h.subtract(BigInteger.valueOf(1))).divide(BigInteger.valueOf(2))).multiply(w);
            if(w.remainder(BigInteger.valueOf(2)) != BigInteger.valueOf(0)){
                ans = ans.add(((w.subtract(BigInteger.valueOf(1))).divide(BigInteger.valueOf(2))).add(BigInteger.valueOf(1)));
            }
            else{
                ans = ans.add(w.divide(BigInteger.valueOf(2)));
            }
        }
        else{
            ans = w.multiply(h.divide(BigInteger.valueOf(2)));
        }
        System.out.println(ans);
    }
}