N = int(input())
A = list(map(int, input().split()))

ans = 0  # 水色のマスの個数

LIFO = []
LIFO.append(["B", A[0]])
ans += A[0]

print(ans)

for i in range(1, N):
    new_L = A[i]
    if i % 2 == 0:
        new_color = "B"
    else:
        new_color = "G"
    
    del_cnt = 0 # 末端から削除したマスの個数
    
    # 末端からnew_L個を削除する (そもそもnew_L個無い可能性にも注意!)
    while True:
        
        if not LIFO:
            break
        
        end_color, end_L = LIFO.pop()
        
        if del_cnt + end_L == new_L:
            del_cnt += end_L
            
            if end_color == "B":
                ans -= end_L
            
            break
        
        elif del_cnt + end_L < new_L:
            del_cnt += end_L
            
            if end_color == "B":
                ans -= end_L
        
        elif del_cnt + end_L > new_L:  # 消しすぎ
            LIFO.append([end_color, end_L - (new_L - del_cnt)])
            
            if end_color == "B":
                ans -= (new_L - del_cnt)
            
            del_cnt += (new_L - del_cnt)
            break
            
        
    
    # 新しいものを末端に追加
    if LIFO:
        if LIFO[-1][0] == new_color:
            LIFO[-1][1] += new_L
        else:
            LIFO.append([new_color, new_L])
    else:
        LIFO.append([new_color, new_L])
    
    if new_color == "B":
        ans += new_L
    
    print(ans)