a,b,c,extra = map(int,input().split()) out = a + b + c + extra t = [a,b,c] for p in t: for q in t: for r in t: x = p + q + r if x > out: out = x print(out)