import itertools

p, q, r = list(map(int, input().split()))

mn = 10 ** 9

for v in itertools.combinations([p, q, r], 2):

    mn = min(mn, v[0]+v[1])

print(mn)

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

l.sort()

print((l[0]+l[1]))

import itertools

p, q, r = list(map(int, input().split()))
mn = 10**9
for v in itertools.combinations([p, q, r], 2):
    mn = min(mn, v[0] + v[1])
print(mn)

l = list(map(int, input().split()))
l.sort()
print((l[0] + l[1]))

-import itertools - -p, q, r = list(map(int, input().split())) -mn = 10**9 -for v in itertools.combinations([p, q, r], 2): -    mn = min(mn, v[0] + v[1]) -print(mn) +l = list(map(int, input().split())) +l.sort() +print((l[0] + l[1]))