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 ret = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ret = (ret << 1) + (ret << 3) + ch - '0';
    ch = getchar();
  }
  return ret * f;
}
int a, b, ansx, ansy;
pair<int, int> calc(int n, int m) {
  if (n == 1) {
    if (m == 0) return make_pair(0, 0);
    if (m == 1) return make_pair(0, 1);
    if (m == 2) return make_pair(1, 1);
    if (m == 3) return make_pair(1, 0);
  }
  int len = 1 << (n - 1), mod = 1 << (2 * n - 2), cas, x, y;
  pair<int, int> tmp = calc(n - 1, m % mod);
  x = tmp.first;
  y = tmp.second;
  cas = m / mod;
  if (cas == 1) return make_pair(x, y + len);
  if (cas == 2) return make_pair(x + len, y + len);
  if (cas == 0) return make_pair(y, x);
  if (cas == 3) return make_pair(len * 2 - y - 1, len - x - 1);
}
int main() {
  a = read();
  b = read();
  pair<int, int> ans;
  ans = calc(a, b);
  ansx = ans.first;
  ansy = ans.second;
  printf("%d %d\n", ansx, ansy);
  return 0;
}