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

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

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

a, b, x, y = [int(eval(input())) for _ in range(4)]
print((min(a, b) + min(x, y)))

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