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;
const int INF = 1029384756;
const double PI = acos(-1);
const double EPS = 0.0000000304;
int a, b;
int ps[4] = {1, 0, 0, 3};
pair<int, int> po[4];
pair<int, int> ans;
void meteor(int sz, int p, int dir, bool rt) {
  if (!sz) {
    return;
  }
  int np = (1 << (sz - 1));
  int t = p / (np * np);
  if (rt) {
    t = 3 - t;
  }
  int he = (dir + t) % 4;
  ans.first += po[he].first * np;
  ans.second += po[he].second * np;
  if (t == 1 || t == 2)
    meteor(sz - 1, p % (np * np), (ps[t] + dir) % 4, rt);
  else
    meteor(sz - 1, p % (np * np), (ps[t] + dir) % 4, !rt);
}
int main() {
  po[0] = make_pair((1), (0));
  po[1] = make_pair((0), (0));
  po[2] = make_pair((0), (1));
  po[3] = make_pair((1), (1));
  scanf("%d%d", &a, &b);
  meteor(a, b, 1, 0);
  printf("%d %d\n", ans.first, ans.second);
}