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;
vector<string> rotate90degrees(vector<string> abc) {
  vector<string> def =
      vector<string>(((int)(abc[0]).size()), string(((int)(abc).size()), '.'));
  for (int(i) = 0; (i) < (((int)(abc).size())); ++(i)) {
    for (int(j) = 0; (j) < (((int)(abc[0]).size())); ++(j)) {
      def[((int)(abc[0]).size()) - 1 - j][i] = abc[i][j];
    }
  }
  return def;
}
int IsPrime(long long number) {
  if (number <= 1LL) return 0;
  for (long long i = 2LL; i * i <= number; i = (i == 2LL ? 3LL : i + 2LL)) {
    if (number % i == 0LL) return 0;
  }
  return 1;
}
void Paint(vector<string>& baru, const vector<string> lama, int sr, int sc) {
  for (int(i) = 0; (i) < (((int)(lama).size())); ++(i))
    for (int(j) = 0; (j) < (((int)(lama[i]).size())); ++(j)) {
      if (lama[i][j] == '.') {
        baru[i + sr][j + sc] = '.';
      }
    }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> base;
  base.push_back(".");
  int x = 1;
  for (int i = 1; i <= n; ++i) {
    int y = 2 * x + 1;
    vector<string> baru(y, string(y, '#'));
    vector<string> ccw = rotate90degrees(base);
    vector<string> cw = rotate90degrees(rotate90degrees(ccw));
    Paint(baru, base, x + 1, 0);
    Paint(baru, base, x + 1, x + 1);
    Paint(baru, ccw, 0, 0);
    Paint(baru, cw, 0, x + 1);
    baru[x][0] = '.';
    baru[x][y - 1] = '.';
    baru[x + 1][x] = '.';
    base = baru;
    x = y;
  }
  int posr = 0;
  int posc = 0;
  int dr[] = {1, 0, -1, 0};
  int dc[] = {0, 1, 0, -1};
  for (int(i) = 0; (i) < (m * 2); ++(i)) {
    base[posr][posc] = '#';
    for (int(j) = 0; (j) < (4); ++(j)) {
      int nr = posr + dr[j];
      int nc = posc + dc[j];
      if (nr >= 0 && nr < x && nc >= 0 && nc < x && base[nr][nc] == '.') {
        posr = nr;
        posc = nc;
        break;
      }
    }
  }
  cout << posc / 2 << " " << posr / 2 << endl;
}