# 01. Sum List Items

n = int(input())
result = 0

for i in range(0, n):
    x = int(input())
    result += x

print(result)
# 01. Sum List Items

n = int(input())
result = 0

for i in range(0, n):
    x = int(input())
    result += x

print(result)
# 01. Sum List Items