a,b,c,d = map(int, input().split()) print(max(c+a+d,c+b+d))