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;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
int a, b, p, q, x, y;
int main() {
  a = read(), b = read();
  for (int i = (a << 1) - 2; i >= 0; i -= 2) {
    y = (x << 2) | (b >> i) & 3;
    p = (p << 1) | (0x936c >> y) & 1;
    q = (q << 1) | (0x39c6 >> y) & 1;
    x = (0x3e6b94c1 >> 2 * y) & 3;
  }
  printf("%d %d\n", p, q);
  return 0;
}