a,b,c,d=map(int,input().split()) b+=31 if a+c<=b: print(1) elif a+d<=b: print(2) else: print(3)