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;
pair<long long, long long> f(long long d, long long k) {
  if (k == 1) {
    if (d == 1) return {1, 1};
    if (d == 2) return {1, 2};
    if (d == 3) return {2, 2};
    if (d == 4) return {2, 1};
  }
  long long cur_d = 1 << (2 * (k - 1));
  if (cur_d >= d) {
    pair<long long, long long> res = f(d, k - 1);
    return {res.second, res.first};
  } else if (2 * cur_d >= d) {
    pair<long long, long long> res = f(d - cur_d, k - 1);
    return {res.first, res.second + (1 << (k - 1))};
  } else if (3 * cur_d >= d) {
    pair<long long, long long> res = f(d - 2 * cur_d, k - 1);
    return {res.first + (1 << (k - 1)), res.second + (1 << (k - 1))};
  } else if (4 * cur_d >= d) {
    pair<long long, long long> res = f(d - 3 * cur_d, k - 1);
    return {(1 << (k)) - res.second + 1, (1 << (k - 1)) - res.first + 1};
  }
}
int main() {
  long long a, b;
  cin >> a >> b;
  b++;
  pair<long long, long long> res = f(b, a);
  cout << res.first - 1 << " " << res.second - 1 << endl;
}