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>
#pragma GCC optimize(2)
using namespace std;
int isprime(int n) {
  if (n < 2) return 0;
  for (int i = 2; i <= n / i; i++)
    if (n % i == 0) return 0;
  return 1;
}
int sum(int n) {
  if (n == 0) return 0;
  return n % 10 + sum(n / 10);
}
int nextprime(int n) {
  for (int i = n + 1;; i++)
    if (isprime(i)) return i;
}
bool issmith(int n) {
  int t = n, s = 0;
  while (t > 1) {
    for (int i = 2; i <= t; i = nextprime(i))
      if (t % i == 0) {
        s += sum(i);
        t /= i;
        break;
      }
  }
  return s == sum(n);
}
int a, cnt;
int main() {
  ios::sync_with_stdio(0);
  cin >> a;
  for (int i = 4; cnt < a; i++) {
    if (issmith(i) && !isprime(i)) cnt++;
    if (cnt == a) cout << i;
  }
  return 0;
}