a = list(map(int, input().split()))

b = list(map(int, input().split()))



def sum(x):

    sum = 0

    for i in range(4):

        sum += x[i]

    return sum



A = sum(a)

B = sum(b)



print((A if A > B else B))
a = list(map(int, input().split()))

b = list(map(int, input().split()))

print((max(sum(a),sum(b))))
a = list(map(int, input().split()))
b = list(map(int, input().split()))


def sum(x):
    sum = 0
    for i in range(4):
        sum += x[i]
    return sum


A = sum(a)
B = sum(b)
print((A if A > B else B))

a = list(map(int, input().split()))
b = list(map(int, input().split()))
print((max(sum(a), sum(b))))

- - -def sum(x): -    sum = 0 -    for i in range(4): -        sum += x[i] -    return sum - - -A = sum(a) -B = sum(b) -print((A if A > B else B)) +print((max(sum(a), sum(b))))