#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char *argv[])
{
    ifstream fin("DATA1.txt",ifstream::in);
    freopen("OUT1.txt","w",stdout);
    for(int t =5;t--;){
            int a,b;
            fin>>a>>b;
            puts((a&(1<<b))?"1":"0");
            
    }
    //system("PAUSE");
    return EXIT_SUCCESS;
}

