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;
void rot(long long n, long long *x, long long *y, long long rx, long long ry);
void d2xy(long long n, long long d, long long *x, long long *y) {
  long long rx, ry, s, t = d;
  *x = *y = 0;
  for (s = 1; s < n; s *= 2) {
    rx = 1 & (t / 2);
    ry = 1 & (t ^ rx);
    rot(s, x, y, rx, ry);
    *x += s * rx;
    *y += s * ry;
    t /= 4;
  }
}
void rot(long long n, long long *x, long long *y, long long rx, long long ry) {
  long long t;
  if (ry == 0) {
    if (rx == 1) {
      *x = n - 1 - *x;
      *y = n - 1 - *y;
    }
    t = *x;
    *x = *y;
    *y = t;
  }
}
int main() {
  long long n, d, x, y;
  cin >> n >> d;
  d2xy(1 << n, d, &x, &y);
  cout << x << " " << y << "\n";
  return 0;
}