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> calc(int n, long long m) {
  if (n == 0) return make_pair(0, 0);
  long long len = 1LL << (n - 1), cnt = 1LL << (2 * n - 2);
  pair<long long, long long> pos = calc(n - 1, m % cnt);
  long long x = pos.first, y = pos.second;
  long long z = m / cnt;
  if (z == 0) return make_pair(y, x);
  if (z == 1) return make_pair(x, y + len);
  if (z == 2) return make_pair(x + len, y + len);
  return make_pair(2 * len - y - 1, len - x - 1);
}
int main() {
  long long n, m;
  cin >> n >> m;
  pair<long long, long long> pos = calc(n, m);
  long long x = pos.first, y = pos.second;
  cout << x << " " << y << endl;
  return 0;
}