import heapq

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



heapq.heapify(l)

print((heapq.heappop(l) + heapq.heappop(l)))

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



ans.sort()



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

import heapq

l = list(map(int, input().split()))
heapq.heapify(l)
print((heapq.heappop(l) + heapq.heappop(l)))

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

-import heapq - -l = list(map(int, input().split())) -heapq.heapify(l) -print((heapq.heappop(l) + heapq.heappop(l))) +ans = list(map(int, input().split())) +ans.sort() +print((ans[0] + ans[1]))