<image>

Input

The input contains a single integer a (0 ≤ a ≤ 15).

Output

Output a single integer.

Example

Input


3


Output


13
#include <bits/stdc++.h>
using namespace std;
long long n, ch;
vector<long long> a;
int main() {
  cin >> n;
  for (long long i = 0; i < 4; ++i) {
    a.push_back(n % 2);
    n /= 2;
  }
  reverse(a.begin(), a.end());
  for (long long i = 0; i < 4; ++i) ch += a[i] * pow(2, i);
  ch = (16 + ch - 1) % 16;
  for (long long i = 0; i < 4; ++i) {
    a[i] = ch % 2;
    ch /= 2;
  }
  reverse(a.begin(), a.end());
  ch = 0;
  for (long long i = 0; i < 4; ++i) {
    ch += a[i] * pow(2, i);
  }
  cout << ch << endl;
}
