<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;
  if (n == 0)
    cout << 15 << endl;
  else {
    int a[4], l = 0, i;
    for (l = 0; l < 4; l++) a[l] = 0;
    l = 3;
    while (n) {
      a[l--] = n % 2;
      n /= 2;
    }
    int b[4];
    for (l = 0; l < 4; l++) b[l] = 0;
    for (l = 0, i = 3; (l < 4) && (i >= 0); l++, i--) b[l] = a[i];
    int ans = 0;
    ans = b[0] * 8 + b[1] * 4 + b[2] * 2 + b[3];
    ans -= 1;
    for (i = 0; i < 4; i++) a[i] = 0;
    l = 3;
    while (ans) {
      a[l--] = ans % 2;
      ans /= 2;
    }
    for (i = 3, l = 0; (i >= 0) && (l < 4); i--, l++) b[l] = a[i];
    ans = b[0] * 8 + b[1] * 4 + b[2] * 2 + b[3];
    cout << ans << endl;
  }
}
