

Input

The input contains a single integer a (1 ≤ a ≤ 30).

Output

Output a single integer.

Example

Input

3


Output

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