a,b,o,w = map(int,input().split()) S = a + b + o + w print(max(S - a,S - b))