n = int(eval(input()))

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

ans = 0

for i in range(n):

    tmp = A[i]

    ans += (tmp//2)

    if i < n-1 and tmp %2 and A[i+1] > 0:

        ans += 1

        A[i+1] -= 1

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

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

ans = 0

for i in range(n-1):

    x,y = A[i], A[i+1]

    ans += x//2

    if x%2!=0 and y > 0:

        ans += 1

        A[i+1] -= 1

ans += A[-1]//2



print(ans)
n = int(eval(input()))
A = list(int(eval(input())) for _ in range(n))
ans = 0
for i in range(n):
    tmp = A[i]
    ans += tmp // 2
    if i < n - 1 and tmp % 2 and A[i + 1] > 0:
        ans += 1
        A[i + 1] -= 1
print(ans)

n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
ans = 0
for i in range(n - 1):
    x, y = A[i], A[i + 1]
    ans += x // 2
    if x % 2 != 0 and y > 0:
        ans += 1
        A[i + 1] -= 1
ans += A[-1] // 2
print(ans)

-A = list(int(eval(input())) for _ in range(n)) +A = [int(eval(input())) for _ in range(n)] -for i in range(n): -    tmp = A[i] -    ans += tmp // 2 -    if i < n - 1 and tmp % 2 and A[i + 1] > 0: +for i in range(n - 1): +    x, y = A[i], A[i + 1] +    ans += x // 2 +    if x % 2 != 0 and y > 0: +ans += A[-1] // 2