N=int(eval(input()))

pre=int(eval(input()))

ans=pre//2

pre=pre&1

for i in range(2,N+1):

    Ai=int(eval(input()))

    if pre and Ai>=1:

        ans+=1

        Ai-=1

    ans+=Ai//2

    pre=Ai&1

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

ans=0

s=0

for i in range(1,N+1):

    Ai=int(eval(input()))

    if Ai==0:

        ans+=s//2

        s=0

    else:

        s+=Ai

ans+=s//2

print(ans)
N = int(eval(input()))
pre = int(eval(input()))
ans = pre // 2
pre = pre & 1
for i in range(2, N + 1):
    Ai = int(eval(input()))
    if pre and Ai >= 1:
        ans += 1
        Ai -= 1
    ans += Ai // 2
    pre = Ai & 1
print(ans)

N = int(eval(input()))
ans = 0
s = 0
for i in range(1, N + 1):
    Ai = int(eval(input()))
    if Ai == 0:
        ans += s // 2
        s = 0
    else:
        s += Ai
ans += s // 2
print(ans)

-pre = int(eval(input())) -ans = pre // 2 -pre = pre & 1 -for i in range(2, N + 1): +ans = 0 +s = 0 +for i in range(1, N + 1): -    if pre and Ai >= 1: -        ans += 1 -        Ai -= 1 -    ans += Ai // 2 -    pre = Ai & 1 +    if Ai == 0: +        ans += s // 2 +        s = 0 +    else: +        s += Ai +ans += s // 2