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> rec(int p, int s) {
  int q;
  pair<int, int> c;
  if (p == 1) {
    c.first = bool(s > 1);
    c.second = bool(s % 3);
    return (c);
  }
  p--;
  q = s / (1 << (2 * p));
  s %= (1 << (2 * p));
  c = rec(p, s);
  if (q == 0) swap(c.first, c.second);
  if (q == 1) c.second += (1 << p);
  if (q == 2) {
    c.second += (1 << p);
    c.first += (1 << p);
  }
  if (q == 3) {
    swap(c.first, c.second);
    c.second = (1 << p) - c.second - 1;
    c.first = (1 << (p + 1)) - c.first - 1;
  }
  return (c);
}
int main() {
  if (0) freopen("in.txt", "r", stdin);
  int p, s;
  pair<int, int> c;
  scanf("%d%d", &p, &s);
  c = rec(p, s);
  printf("%d %d\n", c.first, c.second);
  return (0);
}