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>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
inline int read() {
  int x = 0, neg = 1;
  char op = getchar();
  while (!isdigit(op)) {
    if (op == '-') neg = -1;
    op = getchar();
  }
  while (isdigit(op)) {
    x = 10 * x + op - '0';
    op = getchar();
  }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
int a, b;
pair<int, int> solve(int n, int m) {
  if (n == 0) {
    return make_pair(0, 0);
  }
  int len = 1 << (n - 1), mod = 1 << (2 * n - 2), kase;
  pair<int, int> tmp = solve(n - 1, m % mod);
  int x = tmp.first, y = tmp.second;
  kase = m / mod;
  switch (kase) {
    case 1:
      return make_pair(x, y + len);
      break;
    case 2:
      return make_pair(x + len, y + len);
      break;
    case 0:
      return make_pair(y, x);
      break;
    case 3:
      return make_pair(2 * len - y - 1, len - x - 1);
      break;
  }
}
int main() {
  scanf("%d%d", &a, &b);
  pair<int, int> ans = solve(a, b);
  printf("%d %d\n", ans.first, ans.second);
  return 0;
}