<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;
const int MOD = 1e9 + 7, MAX = 1e5 + 5;
long long powN(long long a, long long p) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2);
  z = (z * z) % MOD;
  if (p % 2) z = (z * a) % MOD;
  return z;
}
vector<bool> is_prime(MAX + 1, true);
void Sieve() {
  is_prime[0] = is_prime[1] = false;
  int i, j;
  for (i = 2; i * i <= MAX; i++) {
    if (is_prime[i]) {
      for (j = i * i; j <= MAX; j += i) is_prime[j] = false;
    }
  }
}
int main() {
  int a;
  cin >> a;
  int sum = 0;
  for (int i = 0; i < 4; i++) {
    sum += pow(2, 3 - i) * ((a >> i) & 1);
  }
  a = sum - 1;
  sum = 0;
  for (int i = 0; i < 4; i++) {
    sum += pow(2, 3 - i) * ((a >> i) & 1);
  }
  cout << sum << endl;
}
