N = int(eval(input()))

A = [int(eval(input())) for i in range(N)]

rem = 0

ans = 0

for a in A:

    ans += (rem+a)//2

    rem = 0 if a==0 else (rem+a)%2

print(ans)
N = int(eval(input()))

A = [int(eval(input())) for i in range(N)]



c = ans = 0

for a in A:

    if a==0:

        ans += c//2

        c = 0

    else:

        c += a

ans += c//2

print(ans)
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
rem = 0
ans = 0
for a in A:
    ans += (rem + a) // 2
    rem = 0 if a == 0 else (rem + a) % 2
print(ans)

N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
c = ans = 0
for a in A:
    if a == 0:
        ans += c // 2
        c = 0
    else:
        c += a
ans += c // 2
print(ans)

-rem = 0 -ans = 0 +c = ans = 0 -    ans += (rem + a) // 2 -    rem = 0 if a == 0 else (rem + a) % 2 +    if a == 0: +        ans += c // 2 +        c = 0 +    else: +        c += a +ans += c // 2