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;
string S;
string rot1(string s) {
  string rotate;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'u') rotate += 'r';
    if (s[i] == 'r') rotate += 'u';
    if (s[i] == 'd') rotate += 'l';
    if (s[i] == 'l') rotate += 'd';
  }
  return rotate;
}
string rot2(string s) {
  string rotate;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'u') rotate += 'l';
    if (s[i] == 'r') rotate += 'd';
    if (s[i] == 'd') rotate += 'r';
    if (s[i] == 'l') rotate += 'u';
  }
  return rotate;
}
string f(int a) {
  if (a == 1) return "urd";
  return rot1(f(a - 1)) + "u" + f(a - 1) + "r" + f(a - 1) + "d" +
         rot2(f(a - 1));
}
int main() {
  int n, m, i;
  cin >> n >> m;
  S = f(n);
  int x = 0, y = 0;
  for (i = 0; i < m; i++) {
    if (S[i] == 'u') y++;
    if (S[i] == 'd') y--;
    if (S[i] == 'r') x++;
    if (S[i] == 'l') x--;
  }
  cout << x << " " << y << endl;
  return 0;
}