t = input()
s = 0
for _ in xrange(t):
    a = input()
    if a > 0:
        s += a
print s

46bad0125c32ae4b8e907819e820ad46e382ff0b
t = input()
s = 0
for _ in xrange(t):
    a = input()
    if a > 0:
        s += a
print s
