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