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>
int main() {
  int a, b, bytes[22];
  scanf("%d%d", &a, &b);
  for (int i = 0; i < 2 * a; i++) {
    bytes[2 * a - 1 - i] = (b & 1);
    b /= 2;
  }
  int x = 0, y = 0, distance = (1 << (a - 1));
  int direction = 0, start = 0;
  for (int i = 0; i < 2 * a; i += 2) {
    if (bytes[i] == 0 && bytes[i + 1] == 0) {
    } else if (bytes[i] == 0 && bytes[i + 1] == 1) {
      if (direction == 0 && start == 0) {
        y += distance;
      } else if (direction == 0 && start == 1) {
        y -= distance;
      } else if (direction == 1 && start == 0) {
        x += distance;
      } else if (direction == 1 && start == 1) {
        x -= distance;
      }
    } else if (bytes[i] == 1 && bytes[i + 1] == 0) {
      if (direction == 0 && start == 0) {
        x += distance;
        y += distance;
      } else if (direction == 0 && start == 1) {
        x -= distance;
        y -= distance;
      } else if (direction == 1 && start == 0) {
        x += distance;
        y += distance;
      } else if (direction == 1 && start == 1) {
        x -= distance;
        y -= distance;
      }
    } else if (bytes[i] == 1 && bytes[i + 1] == 1) {
      if (direction == 0 && start == 0) {
        x += 2 * distance - 1;
        y += distance - 1;
      } else if (direction == 0 && start == 1) {
        x -= 2 * distance - 1;
        y -= distance - 1;
      } else if (direction == 1 && start == 0) {
        x += distance - 1;
        y += 2 * distance - 1;
      } else if (direction == 1 && start == 1) {
        x -= distance - 1;
        y -= 2 * distance - 1;
      }
    }
    if ((bytes[i] == 0 && bytes[i + 1] == 0) ||
        (bytes[i] == 1 && bytes[i + 1] == 1)) {
      direction = (direction ^ 1);
    }
    if (bytes[i] == 1 && bytes[i + 1] == 1) {
      start = (start ^ 1);
    }
    distance /= 2;
  }
  printf("%d %d\n", x, y);
  return 0;
}