x, y = map(int, raw_input().split()) x2, y2 = map(int, raw_input().split()) ans = max(abs(x), abs(y)) if x*x2 + y*y2 == 0 and max(abs(x2), abs(y2)) < ans: ans += 1 print ans