a=int(eval(input()))

b=int(eval(input()))

c=int(eval(input()))

d=int(eval(input()))

e = min(a,b)

f = min(c,d)

print((e + f))
a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

d = int(eval(input()))



print((min(a,b)+min(c,d)))
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = min(a, b)
f = min(c, d)
print((e + f))

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
print((min(a, b) + min(c, d)))

-e = min(a, b) -f = min(c, d) -print((e + f)) +print((min(a, b) + min(c, d)))