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;
int ch2(int n) {
  int ans = 0;
  while (n) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}
int ch1(int n) {
  int ans = 0;
  int flag = 0;
  int sq = n;
  for (int i = 2; i <= sq; i++) {
    if (n % i == 0 && sq / i != 1) {
      flag = 1;
      n /= i;
      ans += ch2(i);
      if (i != 1) i--;
    }
  }
  return ans;
}
int a[33];
int n;
int main() {
  int cnt = 0;
  for (int i = 2; i <= 1000; i++) {
    if (ch1(i) == ch2(i)) a[++cnt] = i;
    if (cnt == 30) break;
  }
  cin >> n;
  cout << a[n] << endl;
  return 0;
}