#include using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int rem = b+31-a; if (rem>=c){ cout<<1<=d){ cout<<2<