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>
void polyline(int a, int b, int &x, int &y) {
  int dx[2] = {1, 0}, dy[2] = {0, 1};
  x = y = 0;
  while (a > 0) {
    if (b < (1 << (2 * (a - 1)))) {
      int x0 = dx[1], x1 = dx[0];
      dx[0] = x0;
      dx[1] = x1;
      x0 = dy[1];
      x1 = dy[0];
      dy[0] = x0;
      dy[1] = x1;
    } else if (b < 2 * (1 << (2 * (a - 1)))) {
      x += (1 << (a - 1)) * dy[0];
      y += (1 << (a - 1)) * dy[1];
      b -= (1 << (2 * (a - 1)));
    } else if (b < 3 * (1 << (2 * (a - 1)))) {
      x += (1 << (a - 1)) * (dx[0] + dy[0]);
      y += (1 << (a - 1)) * (dx[1] + dy[1]);
      b -= 2 * (1 << (2 * (a - 1)));
    } else {
      x += ((1 << a) - 1) * dx[0] + ((1 << (a - 1)) - 1) * dy[0];
      y += ((1 << a) - 1) * dx[1] + ((1 << (a - 1)) - 1) * dy[1];
      b -= 3 * (1 << (2 * (a - 1)));
      int x0 = -dx[1], x1 = -dx[0];
      dx[0] = x0;
      dx[1] = x1;
      x0 = -dy[1];
      x1 = -dy[0];
      dy[0] = x0;
      dy[1] = x1;
    }
    --a;
  }
}
int main() {
  int x = 0, y = 0, a, b;
  scanf("%d%d", &a, &b);
  polyline(a, b, x, y);
  printf("%d %d\n", x, y);
  return 0;
}