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;
inline string x1(string s) {
  string ret;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'U') ret += 'R';
    if (s[i] == 'R') ret += 'U';
    if (s[i] == 'D') ret += 'L';
    if (s[i] == 'L') ret += 'D';
  }
  return ret;
}
inline string x2(string s) {
  string ret;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'U') ret += 'L';
    if (s[i] == 'R') ret += 'D';
    if (s[i] == 'D') ret += 'R';
    if (s[i] == 'L') ret += 'U';
  }
  return ret;
}
string f(int a) {
  if (a == 1) return "URD";
  return x1(f(a - 1)) + "U" + f(a - 1) + "R" + f(a - 1) + "D" + x2(f(a - 1));
}
int main() {
  ios::sync_with_stdio(0);
  int a, b;
  cin >> a >> b;
  S = f(a);
  int x = 0, y = 0;
  for (int i = 0; i < b; i++) {
    if (S[i] == 'U') y++;
    if (S[i] == 'D') y--;
    if (S[i] == 'L') x--;
    if (S[i] == 'R') x++;
  }
  cout << x << " " << y << endl;
  return 0;
}