<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 a, i, sum = 0;
  cin >> a;
  if (a == 0)
    cout << 15;
  else {
    int b[4];
    for (int i = 0; i < 4; i++) {
      b[i] = 0;
    }
    i = 0;
    while (a > 0) {
      b[i] = a % 2;
      a /= 2;
      i++;
    }
    for (int i = 0; i < 4; i++) {
      sum += b[i] * pow(2, 4 - i - 1);
    }
    int num = sum - 1;
    i = 0;
    for (int i = 0; i < 4; i++) {
      b[i] = 0;
    }
    while (num > 0) {
      b[i] = num % 2;
      num /= 2;
      i++;
    }
    sum = 0;
    for (int i = 0; i < 4; i++) {
      sum += b[i] * pow(2, 4 - i - 1);
    }
    cout << sum;
  }
  return 0;
}
