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 PYTHON3):

Solution:
def sumDigits(n):
    answer = 0
    while n > 0:
        answer += n%10
        n = n // 10
    return answer

def listFactors(n):
    # Precondition:  n <= 30
    answer = []
    while n > 1:
        for i in range(2,n+1):
            if n%i == 0:
                answer.append(i)
                n = n // i
                break
    return answer

# print("Input i")                  
i = int(input())

test = 4
numsofar = 0
while numsofar < i:
    # print("Checking " + str(test))
    if len(listFactors(test)) > 1:  # It's composite
        # print("Test is composite")
        numsum = sumDigits(test)
        factorsum = 0
        for factor in listFactors(test):
            factorsum += sumDigits(factor)
        if numsum == factorsum:    # We've found one
            numsofar += 1
            if numsofar == i:
                print(test)
                break
    test += 1