X,Y=map(int,input().split()) x,y=map(int,input().split()) n = max(X,Y) + (X==Y and x==y and x