Problem: <image>

Input

The input contains two integers a1, a2 (0 ≤ ai ≤ 32), separated by a single space.

Output

Output a single integer.

Examples

Input

1 1


Output

0


Input

3 7


Output

0


Input

13 10


Output

1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
pair<int, int> gao(int a, int b) {
  if (a == 1) {
    return make_pair(b == 0 || b == 3 ? 0 : 1, b < 2 ? 0 : 1);
  }
  int N = 1 << (2 * a - 2);
  int n = 1 << (a - 1);
  pair<int, int> next = gao(a - 1, b % N);
  int x = next.first;
  int y = next.second;
  if (a % 2 == 0) {
    if (b < N) {
    } else if (b < 2 * N) {
      swap(x, y);
      y += n;
    } else if (b < 3 * N) {
      swap(x, y);
      x += n;
      y += n;
    } else {
      x = n - 1 - x;
      y = n - 1 - y;
      x += n;
    }
  } else {
    if (b < N) {
    } else if (b < 2 * N) {
      swap(x, y);
      x += n;
    } else if (b < 3 * N) {
      swap(x, y);
      x += n;
      y += n;
    } else {
      x = n - 1 - x;
      y = n - 1 - y;
      y += n;
    }
  }
  return make_pair(x, y);
}
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  pair<int, int> res = gao(a, b);
  if (a % 2 == 1) {
    swap(res.first, res.second);
  }
  printf("%d %d\n", res.first, res.second);
  return 0;
}