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;
int x = 0;
int y = 0;
int dx = 1;
int dy = 0;
int nTarget = 0;
int n = 0;
void rotate(bool CW) {
  if (dx == 0) {
    if (dy == 1) {
      dx = CW ? 1 : -1;
    } else {
      dx = CW ? -1 : 1;
    }
    dy = 0;
  } else if (dy == 0) {
    if (dx == 1) {
      dy = CW ? -1 : 1;
    } else {
      dy = CW ? 1 : -1;
    }
    dx = 0;
  }
}
void move() {
  x = x + dx;
  y = y + dy;
  n++;
  if (n == nTarget) {
    cout << x << " " << y << endl;
  }
}
void hilbert(int p, bool cw) {
  if (p <= 0) return;
  rotate(!cw);
  hilbert(p - 1, !cw);
  move();
  rotate(cw);
  hilbert(p - 1, cw);
  move();
  hilbert(p - 1, cw);
  rotate(cw);
  move();
  hilbert(p - 1, !cw);
  rotate(!cw);
}
int main() {
  int p = 0;
  cin >> p >> nTarget;
  if (nTarget == 0) {
    cout << "0 0" << endl;
    return 0;
  }
  hilbert(p, true);
  return 0;
}