<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 main() {
  int n;
  cin >> n;
  int m = 0;
  for (int i = 0; i < 4; i++) {
    m <<= 1;
    m |= (n >> i) & 1;
  }
  n = (m + 15) % 16;
  m = 0;
  for (int i = 0; i < 4; i++) {
    m <<= 1;
    m |= (n >> i) & 1;
  }
  cout << m;
  return 0;
}
