a, b, c, d = map(int, input().split()) t=32-a+b if t>=c: print(1) exit() if t>=d: print(2) exit() print(3)