A,B,C,D = map(int,input().split()) print(max(C+D,C+A+D,C+B+D))