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;
const char* data =
    "111111101010101111100101001111111z100000100000000001010110001000001z101110"
    "100110110000011010001011101z101110101011001001111101001011101z101110101100"
    "011000111100101011101z100000101010101011010000101000001z111111101010101010"
    "101010101111111z000000001111101111100111100000000z100010111100100001011110"
    "111111001z110111001111111100100001000101100z011100111010000101000111010001"
    "010z011110000110001111110101100000011z111111111111111000111001001011000z11"
    "1000010111010011010011010100100z101010100010110010110101010000010z10110000"
    "0101010001111101000000000z000010100011001101000111101011010z10100100111110"
    "1111000101010001110z101101111111000100100001110001000z00001001100010011000"
    "0011010000010Z001101101001101110010010011011000z01110101101000100011110101"
    "0100110z111010100110011101001101000001110z11000101001010111100010111111100"
    "0z001000111011100001010110111110000z000000001110010110100010100010110z1111"
    "11101000101111000110101011010z100000100111010101111100100011011z1011101010"
    "01010000101000111111000z101110100011010010010111111011010z1011101001000110"
    "11110110101110000z100000100110011001111100111100000z1111111011010001010011"
    "01110010001z";
int main() {
  int d, d2;
  scanf("%d%d", &d2, &d);
  int cx = 0;
  int cy = 0;
  int i = 0;
  while (data[i]) {
    if ((d == cx) && (d2 == cy)) {
      printf("%c", data[i]);
      break;
    }
    if (data[i] == '0' || data[i] == '1') {
      cx++;
    } else {
      if (cx) {
        cx = 0;
        cy++;
      }
    }
    i++;
  }
  return 0;
}