N = int(eval(input()))

a = [int(eval(input())) for _ in range(N)] + [0]

ans = 0



for i in range(N):

    if a[i] != 0:

        add, mod = divmod(a[i], 2)

        ans += add

        if a[i + 1] != 0:

            a[i + 1] += mod



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

a = [int(eval(input())) for _ in range(N)]

ans = 0

for i in range(N):

    cnt, mod = divmod(a[i], 2)

    ans += cnt

    if i < N - 1 and a[i + 1] != 0:

        a[i + 1] += mod



print(ans)
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)] + [0]
ans = 0
for i in range(N):
    if a[i] != 0:
        add, mod = divmod(a[i], 2)
        ans += add
        if a[i + 1] != 0:
            a[i + 1] += mod
print(ans)

N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
ans = 0
for i in range(N):
    cnt, mod = divmod(a[i], 2)
    ans += cnt
    if i < N - 1 and a[i + 1] != 0:
        a[i + 1] += mod
print(ans)

-a = [int(eval(input())) for _ in range(N)] + [0] +a = [int(eval(input())) for _ in range(N)] -    if a[i] != 0: -        add, mod = divmod(a[i], 2) -        ans += add -        if a[i + 1] != 0: -            a[i + 1] += mod +    cnt, mod = divmod(a[i], 2) +    ans += cnt +    if i < N - 1 and a[i + 1] != 0: +        a[i + 1] += mod