a, b, c, d = [int(eval(input())) for i in range(4)]

print((min(a, b)+min(c, d)))
a,b,c,d = (int(eval(input())) for i in range(4))

print((min(a,b)+min(c,d)))
a, b, c, d = [int(eval(input())) for i in range(4)]
print((min(a, b) + min(c, d)))

a, b, c, d = (int(eval(input())) for i in range(4))
print((min(a, b) + min(c, d)))

-a, b, c, d = [int(eval(input())) for i in range(4)] +a, b, c, d = (int(eval(input())) for i in range(4))