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