a,b,c,d,e,f=[int(eval(input())) for _ in range(6)]

print((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))
print((sum(sorted(int(eval(input())) for _ in range(4))[1:])+max([int(eval(input())) for _ in range(2)])))
a, b, c, d, e, f = [int(eval(input())) for _ in range(6)]
print((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))

print(
    (
        sum(sorted(int(eval(input())) for _ in range(4))[1:])
        + max([int(eval(input())) for _ in range(2)])
    )
)

-a, b, c, d, e, f = [int(eval(input())) for _ in range(6)] -print((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d]))) +print( +    ( +        sum(sorted(int(eval(input())) for _ in range(4))[1:]) +        + max([int(eval(input())) for _ in range(2)]) +    ) +)