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 x, y, u, v, d, a, b;
int main() {
  scanf("%d%d", &a, &b);
  d = 1;
  while (a) {
    switch (b % 4) {
      case 0:
        u = y, v = x;
        break;
      case 1:
        u = x, v = y + d;
        break;
      case 2:
        u = x + d, v = y + d;
        break;
      case 3:
        u = 2 * d - y - 1, v = d - x - 1;
        break;
    }
    x = u, y = v;
    d *= 2;
    a--;
    b /= 4;
  }
  printf("%d %d\n", x, y);
  return 0;
}