# -*- coding: utf-8 -*- X, Y = map(int, raw_input().split()) x, y = map(int, raw_input().split()) delX = abs(X) delY = abs(Y) if delY == delX: step = delX if x == y: step += 2 else: step = max(delX, delY) print step