<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;
int n;
int a[4], ans[4];
int main() {
  cin >> n;
  int i = 0;
  while (n) {
    if (n & 1)
      a[i] = 1;
    else
      a[i] = 0;
    n >>= 1;
    i++;
  }
  int res = 0;
  ans[0] = 1 - ((a[1] | a[2] | a[3]) ^ a[0]);
  ans[1] = 1 - ((a[2] | a[3]) ^ a[1]);
  ans[2] = 1 - ((a[3]) ^ a[2]);
  ans[3] = 1 - (a[3]);
  for (int i = 3; i >= 0; i--) {
    res = (res << 1) + ans[i];
  }
  cout << res << endl;
  return 0;
}
