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 mv;
int X, Y;
void makeMove(int dx, int dy) {
  X += dx;
  Y += dy;
  mv--;
  if (!mv) {
    printf("%d %d\n", X, Y);
    exit(0);
  }
}
void move(int base, int A, int B) {
  if (base) {
    if ((A == 0) && (B == 1)) {
      move(base - 1, 0, 3);
      makeMove(0, 1);
      move(base - 1, 0, 1);
      makeMove(1, 0);
      move(base - 1, 0, 1);
      makeMove(0, -1);
      move(base - 1, 2, 1);
    } else if ((A == 0) && (B == 3)) {
      move(base - 1, 0, 1);
      makeMove(1, 0);
      move(base - 1, 0, 3);
      makeMove(0, 1);
      move(base - 1, 0, 3);
      makeMove(-1, 0);
      move(base - 1, 2, 3);
    } else if ((A == 1) && (B == 0)) {
      move(base - 1, 1, 2);
      makeMove(0, 1);
      move(base - 1, 1, 0);
      makeMove(-1, 0);
      move(base - 1, 1, 0);
      makeMove(0, -1);
      move(base - 1, 3, 0);
    } else if ((A == 1) && (B == 2)) {
      move(base - 1, 1, 0);
      makeMove(-1, 0);
      move(base - 1, 1, 2);
      makeMove(0, 1);
      move(base - 1, 1, 2);
      makeMove(1, 0);
      move(base - 1, 3, 2);
    } else if ((A == 2) && (B == 1)) {
      move(base - 1, 2, 3);
      makeMove(-1, 0);
      move(base - 1, 2, 1);
      makeMove(0, -1);
      move(base - 1, 2, 1);
      makeMove(1, 0);
      move(base - 1, 0, 1);
    } else if ((A == 2) && (B == 3)) {
      move(base - 1, 2, 1);
      makeMove(0, -1);
      move(base - 1, 2, 3);
      makeMove(-1, 0);
      move(base - 1, 2, 3);
      makeMove(0, 1);
      move(base - 1, 0, 3);
    } else if ((A == 3) && (B == 0)) {
      move(base - 1, 3, 2);
      makeMove(1, 0);
      move(base - 1, 3, 0);
      makeMove(0, -1);
      move(base - 1, 3, 0);
      makeMove(0, -1);
      move(base - 1, 1, 0);
    } else if ((A == 3) && (B == 2)) {
      move(base - 1, 3, 0);
      makeMove(0, -1);
      move(base - 1, 3, 2);
      makeMove(1, 0);
      move(base - 1, 3, 2);
      makeMove(0, 1);
      move(base - 1, 1, 2);
    } else {
      printf("WTF\n");
      exit(1);
    }
  }
}
int main() {
  X = 0;
  Y = 0;
  int base;
  scanf("%d %d", &base, &mv);
  if (mv == 0) {
    printf("0 0\n");
    return 0;
  }
  int final = 1;
  for (int i = 0; i < base; i++) {
    final *= 2;
  }
  move(base, 0, 1);
  return 0;
}