A,B,O,W = map(int, input().split(' ')) ans = max([ # A A + W, # B B + W, # O O + A + W, O + B + W, # AB W ]) print(ans)