<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;
long long n;
string s = "";
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  if (n == 0) {
    cout << 15;
    return 0;
  }
  if (n >= 8) {
    s += '1';
    n -= 8;
  } else
    s += '0';
  if (n >= 4) {
    s += '1';
    n -= 4;
  } else
    s += '0';
  if (n >= 2) {
    s += '1';
    n -= 2;
  } else
    s += '0';
  if (n >= 1) {
    s += '1';
    n -= 1;
  } else
    s += '0';
  reverse(s.begin(), s.end());
  n = 0;
  for (int i = 0; i < 4; i++) n += ((s[i] - '0') * ((long long)1 << (3 - i)));
  n--;
  s = "";
  if (n >= 8) {
    s += '1';
    n -= 8;
  } else
    s += '0';
  if (n >= 4) {
    s += '1';
    n -= 4;
  } else
    s += '0';
  if (n >= 2) {
    s += '1';
    n -= 2;
  } else
    s += '0';
  if (n >= 1) {
    s += '1';
    n -= 1;
  } else
    s += '0';
  reverse(s.begin(), s.end());
  n = 0;
  for (int i = 0; i < 4; i++) n += ((s[i] - '0') * ((long long)1 << (3 - i)));
  cout << n;
  return 0;
}
