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 search(int k, int n, int &x, int &y) {
  int c, tmp;
  if (k == 0) {
    x = 0;
    y = 0;
    return;
  }
  c = 0;
  for (int i = 0; i < k - 1; i++) c = 4 * c + 3;
  tmp = (1 << k - 1) - 1;
  if (n <= c) {
    search(k - 1, n, x, y);
    x ^= y, y ^= x, x ^= y;
  } else if (n <= 2 * c + 1) {
    search(k - 1, n - c - 1, x, y);
    y += tmp + 1;
  } else if (n <= 3 * c + 2) {
    search(k - 1, n - c - 1 - c - 1, x, y);
    x += tmp + 1;
    y += tmp + 1;
  } else {
    search(k - 1, n - 3 * c - 3, x, y);
    x = tmp - x;
    y = tmp - y;
    x ^= y, y ^= x, x ^= y;
    x += tmp + 1;
  }
}
int main() {
  int a, b, x, y;
  scanf("%d%d", &a, &b);
  search(a, b, x, y);
  printf("%d %d\n", x, y);
  return 0;
}