#include using namespace std; int main(){ int x,y; cin>>x>>y; cout<<((x+4)%12^(x+8)%12^y)<