#coding=UTF-8 mojir=input() hyo=mojir.split(' ') x=int(hyo[0]) y=int(hyo[1]) mojir=input() hyo=mojir.split(' ') x2=int(hyo[0]) y2=int(hyo[1]) ans=max(abs(x),abs(y)) if abs(x)==abs(y) and abs(x2)==abs(y2): if abs(x)>abs(x2) and (x//abs(x),y//abs(y)) == (x2//abs(x2),y2//abs(y2)): ans=ans+1#避ける必要がある print(ans)