A, B, C, D = int(eval(input())), int(eval(input())), int(eval(input())), int(eval(input()))

fare = 0

if A <= B : fare += A

else : fare += B

if C <= D : fare += C

else : fare += D

print(fare)
Train = [int(eval(input())), int(eval(input()))]

Bus = [int(eval(input())), int(eval(input()))]

print((min(Train) + min(Bus)))
A, B, C, D = (
    int(eval(input())),
    int(eval(input())),
    int(eval(input())),
    int(eval(input())),
)
fare = 0
if A <= B:
    fare += A
else:
    fare += B
if C <= D:
    fare += C
else:
    fare += D
print(fare)

Train = [int(eval(input())), int(eval(input()))]
Bus = [int(eval(input())), int(eval(input()))]
print((min(Train) + min(Bus)))

-A, B, C, D = ( -    int(eval(input())), -    int(eval(input())), -    int(eval(input())), -    int(eval(input())), -) -fare = 0 -if A <= B: -    fare += A -else: -    fare += B -if C <= D: -    fare += C -else: -    fare += D -print(fare) +Train = [int(eval(input())), int(eval(input()))] +Bus = [int(eval(input())), int(eval(input()))] +print((min(Train) + min(Bus)))