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:
"""
http://codeforces.com/contest/784/problem/A
"""

def prime_factors(n):
    def prime_factors(n, primes):
        if n <= 1:
            return primes

        for i in range(2, n + 1):
            if n % i == 0:
                primes.append(i)
                return prime_factors(n // i, primes)
    return prime_factors(n, [])

def digit_sum(n):
    s = str(n)
    total = 0
    for c in s:
        total += int(c)
    return total


def joke_num(p):
    n = 2
    count = 0

    while count != p:
        prime_facts = prime_factors(n)
        if len(prime_facts) != 1 and sum(map(digit_sum, prime_facts)) == digit_sum(n):
            curr = n
            count += 1
        n += 1

    return curr


def main():
    a = int(input())
    print(joke_num(a))


if __name__ == '__main__':
    main()