x,y = map(int,raw_input().split(" ")) x2,y2 = map(int,raw_input().split(" ")) if (x-x2)*x2 > 0 and (y-y2)*y2 > 0 and abs(x) == abs(y) and abs(x2) == abs(y2): print abs(x) + 1 else: print abs(x) if abs(x) > abs(y) else abs(y)