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[2], y[2], z;
int x0, yy0, a, b, bb;
int p4[20], sw;
int main() {
  p4[0] = 1;
  for (z = 1; z <= 10; z++) p4[z] = p4[z - 1] * 4;
  scanf("%d%d", &a, &b);
  x[0] = y[1] = 1;
  x[1] = y[0] = 0;
  x0 = yy0 = 0;
  sw = a % 2;
  for (; a > 1; a--) {
    z = b / p4[a - 1];
    b %= p4[a - 1];
    if (z)
      if (a % 2 == 0) {
        x0 += y[0] << a - 1;
        yy0 += y[1] << a - 1;
        x0 += (x[0] << a - 1) * (z - 1);
        yy0 += (x[1] << a - 1) * (z - 1);
      } else {
        x0 += x[0] << a - 1;
        yy0 += x[1] << a - 1;
        x0 += (y[0] << a - 1) * (z - 1);
        yy0 += (y[1] << a - 1) * (z - 1);
      }
    if (z == 3) {
      x0 -= x[0] + y[0];
      yy0 -= x[1] + y[1];
    }
    switch (z) {
      case 1:
      case 2:
        swap(x[0], x[1]);
        swap(y[0], y[1]);
        break;
      case 3:
        x[0] = -x[0];
        y[0] = -y[0];
        x[1] = -x[1];
        y[1] = -y[1];
        break;
    }
  }
  switch (b) {
    case 1:
      x0 += x[0];
      yy0 += x[1];
      break;
    case 2:
      x0 += x[0] + y[0];
      yy0 += x[1] + y[1];
      break;
    case 3:
      x0 += y[0];
      yy0 += y[1];
      break;
  }
  printf("%d %d\n", sw ? yy0 : x0, sw ? x0 : yy0);
  return 0;
}