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

Solution:
#include <bits/stdc++.h>
using namespace std;
vector<bool> used;
int ans[35];
int main() {
  int n;
  cin >> n;
  ans[1] = 4;
  ans[2] = 22;
  ans[3] = 27;
  ans[4] = 58;
  ans[5] = 85;
  ans[6] = 94;
  ans[7] = 121;
  ans[8] = 166;
  ans[9] = 202;
  ans[10] = 265;
  ans[11] = 274;
  ans[12] = 319;
  ans[13] = 346;
  ans[14] = 355;
  ans[15] = 378;
  ans[16] = 382;
  ans[17] = 391;
  ans[18] = 438;
  ans[19] = 454;
  ans[20] = 483;
  ans[21] = 517;
  ans[22] = 526;
  ans[23] = 535;
  ans[24] = 562;
  ans[25] = 576;
  ans[26] = 588;
  ans[27] = 627;
  ans[28] = 634;
  ans[29] = 636;
  ans[30] = 645;
  ans[31] = 648;
  ans[32] = 654;
  cout << ans[n];
  return 0;
}