#include upstreamusing namespace std;int main(){int speed{ 0 };int mode{ 0 };cin >> speed >> mode;if(speed < 1660 && mode == 0) cout << 1;else if(speed < 1685 && mode == 1) cout << 1;else cout << 0;}