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;
string DecToBit4(int dec) {
  int i, n = dec, Log, Pow;
  char bit4[4] = {'0', '0', '0', '0'};
  string str = "";
  while (n > 0) {
    Log = log(1.0 * n) / log(2.0);
    bit4[3 - Log] = '1';
    Pow = pow(2.0, Log);
    n -= Pow;
  }
  for (i = 0; i < 4; i++) {
    str += bit4[i];
  }
  return str;
}
int Bit4ToDec(string bit4) {
  int i, n = 0;
  for (i = 0; i < 4; i++) {
    if (bit4[i] == '1') {
      n += pow(2.0, 3 - i);
    }
  }
  return n;
}
int main() {
  int a, n;
  string str;
  cin >> a;
  if (a == 0) {
    cout << "15\n";
  } else {
    n = a;
    str = DecToBit4(n);
    reverse(str.begin(), str.end());
    n = Bit4ToDec(str);
    n--;
    str = DecToBit4(n);
    reverse(str.begin(), str.end());
    n = Bit4ToDec(str);
    cout << n << "\n";
  }
  return 0;
}