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;
int rx, ry;
void go(int lev, int b, int xa, int ya, int xv, int yv) {
  if (lev == 0) {
    rx = xa;
    ry = ya;
    return;
  }
  --lev;
  int t = (b >> (lev * 2)) & 3;
  if (t == 0) {
    go(lev, b, xa, ya, yv, xv);
  } else if (t == 1) {
    go(lev, b, xa + yv * (1 << (lev)), ya + xv * (1 << (lev)), xv, yv);
  } else if (t == 2) {
    go(lev, b, xa + yv * (1 << (lev)) + xv * (1 << (lev)),
       ya + xv * (1 << (lev)) + yv * (1 << (lev)), xv, yv);
  } else if (t == 3) {
    go(lev, b, xa + xv * ((1 << (lev + 1)) - 1) + yv * ((1 << (lev)) - 1),
       ya + yv * ((1 << (lev + 1)) - 1) + xv * ((1 << (lev)) - 1), -yv, -xv);
  }
}
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  go(a, b, 0, 0, 1, 0);
  printf("%d %d\n", rx, ry);
  return 0;
}