n = int(input())
s = 0
a = [int(n) for n in input().split()]
for i in range(0, len(a)):
    if a[i] < 0:
        s = s + a[i]
print(s)

bbaf13e85f28ca7c65dbc44a7c7a5a8fc6ab20c6
<mask token>

<mask token>
for i in range(0, len(a)):
    if a[i] < 0:
        s = s + a[i]
print(s)

n = int(input())
s = 0
a = [int(n) for n in input().split()]
for i in range(0, len(a)):
    if a[i] < 0:
        s = s + a[i]
print(s)
