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;
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
long long int MOD = 1000000007;
template <typename T>
T gcd(T x, T y) {
  return y == 0 ? x : gcd(y, x % y);
}
template <typename T>
T lcm(const T &a, const T &b) {
  return (a * b) / gcd(a, b);
}
long long int min(long long int a, long long int b) { return (a < b ? a : b); }
long long int max(long long int a, long long int b) { return (a > b ? a : b); }
long long int min3(long long int a, long long int b, long long int c) {
  return min(a, min(b, c));
}
long long int max3(long long int a, long long int b, long long int c) {
  return max(a, max(b, c));
}
long long int nextPowerOf2(long long int n);
long long int raiseToPow(long long int x, long long int power);
long long int powerMod(long long int x, long long int y, long long int p);
void primeFactors(long long int n);
bool isPowerOfTwo(long long int x);
void allFactors(long long int n);
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cout.precision(10);
  cout << fixed;
  int n, arr[] = {4,   22,  27,  58,  85,  94,  121, 166, 202, 265,
                  274, 319, 346, 355, 378, 382, 391, 438, 454, 483,
                  517, 526, 535, 562, 576, 588, 627, 634, 636, 645};
  cin >> n;
  cout << arr[n - 1];
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  return 0;
}
void printDivisors(long long int n) {
  for (long long int i = 1; i <= sqrt(n) + 1; i++) {
    if (n % i == 0) {
      if (n / i == i)
        printf("%d ", i);
      else
        printf("%d %d ", i, n / i);
    }
  }
}
long long int nextPowerOf2(long long int n) {
  long long int count = 0;
  if (n && !(n & (n - 1))) return n;
  while (n != 0) {
    n >>= 1;
    count += 1;
  }
  return 1 << count;
}
long long int raiseToPow(long long int x, long long int power) {
  long long int result;
  long long int i;
  result = 1;
  for (i = 1; i <= power; i++) {
    result = result * x;
  }
  return (result);
}
long long int powerMod(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); }
void primeFactors(long long int n) {
  while (n % 2 == 0) {
    printf("%d ", 2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      printf("%d ", i);
      n = n / i;
    }
  }
  if (n > 2) printf("%d ", n);
}