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>
const int MAX_LEN = 1010;
using namespace std;
template <typename U, typename V>
string to_string(pair<U, V>);
string to_string(const string& e_) { return "\"" + e_ + "\""; }
string to_string(char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string(bool e_) { return e_ ? "true" : "false"; }
template <typename T>
string to_string(T e_) {
  string s_ = "[ ";
  for (const auto& x_ : e_) s_ += to_string(x_) + " ";
  return s_ + "]";
}
template <typename U, typename V>
string to_string(pair<U, V> e_) {
  return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str() { ; }
template <typename U, typename... V>
void dbg_str(U u, V... v) {
  ;
  dbg_str(v...);
}
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 pair<int, int>(x, y + len);
      break;
    case 2:
      return pair<int, int>(x + len, y + len);
      break;
    case 0:
      return pair<int, int>(y, x);
      break;
    case 3:
      return pair<int, int>(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);
}