#include using namespace std; int main() { int M,D; cin>>M>>D; if(M==4 and D==1) { cout<<0; }else { cout<