n = int(eval(input()))

A = [int(eval(input())) for _ in range(n)]

ans = 0

temp = 0

for i in range(n):

    ans += (A[i]+temp)//2

    if A[i] != 0:

        temp = (A[i]+temp)%2

    else:

        temp = 0

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

temp = 0

ans = 0

for i in range(n):

    a = int(eval(input()))

    if a != 0:

        q, r = divmod(a+temp, 2)

        ans += q

        temp = r

    else:

        temp = 0

print(ans)

n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
ans = 0
temp = 0
for i in range(n):
    ans += (A[i] + temp) // 2
    if A[i] != 0:
        temp = (A[i] + temp) % 2
    else:
        temp = 0
print(ans)

n = int(eval(input()))
temp = 0
ans = 0
for i in range(n):
    a = int(eval(input()))
    if a != 0:
        q, r = divmod(a + temp, 2)
        ans += q
        temp = r
    else:
        temp = 0
print(ans)

-A = [int(eval(input())) for _ in range(n)] +temp = 0 -temp = 0 -    ans += (A[i] + temp) // 2 -    if A[i] != 0: -        temp = (A[i] + temp) % 2 +    a = int(eval(input())) +    if a != 0: +        q, r = divmod(a + temp, 2) +        ans += q +        temp = r