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;
struct XD {
  int x, y;
  XD(int xx, int yy) : x(xx), y(yy) {}
  void print() { printf("%d %d\n", x, y); }
};
int pows[30];
inline XD solve(int a, int b) {
  if (a == 0) return XD(0, 0);
  int sz = pows[2 * (a - 1)];
  XD k = solve(a - 1, b % sz);
  swap(k.x, k.y);
  if (b < sz)
    return k;
  else if (b < 2 * sz) {
    swap(k.x, k.y);
    k.y += pows[a - 1];
  } else if (b < 3 * sz) {
    swap(k.x, k.y);
    k.x += pows[a - 1];
    k.y += pows[a - 1];
  } else {
    k.x = pows[a] - 1 - k.x;
    k.y = pows[a - 1] - 1 - k.y;
  }
  return k;
}
int main() {
  int a, b, i;
  pows[0] = 1;
  for (i = 1; i < 30; i++) pows[i] = pows[i - 1] * 2;
  while (scanf("%d%d", &a, &b) != EOF) {
    solve(a, b).print();
  }
}