<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 testbit(int n, int m) { return (n >> m) & 1; }
int main() {
  int a;
  scanf("%d", &a);
  int res = 0;
  int x[4];
  for (int i = 0; i < 4; i++) x[i] = testbit(a, i);
  int y[4] = {};
  for (int i = 3; i >= 0; i--) {
    y[i] = x[i];
    bool all = true;
    for (int j = i + 1; j < 4; j++) all &= y[j];
    if (all) y[i] = !y[i];
  }
  for (int i = 0; i < 4; i++) res |= y[i] << i;
  printf("%d\n", res);
  return 0;
}
