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

Solution:
d = {1: 4,
    2: 22,
    3: 27,
    4: 58,
    5: 85,
    6: 94,
    7: 121,
    8: 166,
    9: 202,
    10: 265,
    11: 274,
    12: 319,
    13: 346,
    14: 355,
    15: 378,
    16: 382,
    17: 391,
    18: 438,
    19: 454,
    20: 483,
    21: 517,
    22: 526,
    23: 535,
    24: 562,
    25: 576,
    26: 588,
    27: 627,
    28: 634,
    29: 636,
    30: 645}
print(d[int(raw_input())])