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<int, int> ff(int x, int y) {
  if (x == 1) {
    if (y == 0) return make_pair(0, 0);
    if (y == 1) return make_pair(0, 1);
    if (y == 2) return make_pair(1, 1);
    if (y == 3) return make_pair(1, 0);
  }
  int p = 1 << x * 2 - 2;
  if (y < p) {
    pair<int, int> S = ff(x - 1, y);
    return make_pair(S.second, S.first);
  }
  if (y < p * 2) {
    pair<int, int> S = ff(x - 1, y - p);
    return make_pair(S.first, S.second + (1 << x - 1));
  }
  if (y < p * 3) {
    pair<int, int> S = ff(x - 1, y - p * 2);
    return make_pair(S.first + (1 << x - 1), S.second + (1 << x - 1));
  }
  if (y < p * 4) {
    pair<int, int> S = ff(x - 1, y - p * 3);
    return make_pair((1 << x) - 1 - S.second, (1 << x - 1) - 1 - S.first);
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  pair<int, int> S = ff(n, m);
  printf("%d %d\n", S.first, S.second);
  return 0;
}