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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
pair<int, int> doit(int a, int b) {
  if (b < 0) exit(123);
  if (!b) return make_pair(0, 0);
  int l = (1 << (2 * a)) - 1;
  int s = (1 << a) - 1;
  if (b == l) return make_pair(s, 0);
  if (b > l) exit(123);
  if (b > l / 2) {
    pair<int, int> t = doit(a, l - b);
    t.first = s - t.first;
    return t;
  }
  if (b <= l / 4) {
    pair<int, int> t = doit(a - 1, b);
    swap(t.first, t.second);
    return t;
  } else {
    pair<int, int> t = doit(a - 1, b - l / 4 - 1);
    t.second += s / 2 + 1;
    return t;
  }
}
int main() {
  int a, b;
  cin >> a >> b;
  pair<int, int> r = doit(a, b);
  cout << r.first << ' ' << r.second;
  return 0;
}