#include <iostream>
#include <cmath>
#include <string>
#include <array>
#include <queue>
 
using namespace std;
 
#define ll long long int 
 
 int max(int a, int b){
    if (a<=b)
    {
        return b;
    }
    else{
        return a;
    }
} 

void solve(){
   ll n;
    cin>>n;
    ll a[n];
    ll p[n];
    ll maxval;
    ll add;
    ll prev;
    ll prev1;
    ll x[n];
    prev=0;
    add = 0;
    maxval = 0;
    prev1=0;
    //out<<maxval<<add<<prev;
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
        maxval = max(maxval, a[i]);
        add+=a[i];
        p[i] = add;
        //prev = p[i];
        x[i] = p[i]+prev1;
        prev1=x[i];
        //cout<<p[i];
        cout<<x[i]+((i+1)*maxval)<<endl;
    }

    for (int i = 0; i < n; ++i)
    {
        
    }
}
 
int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ll t;
    t= 1;
    for(int i = 0; i<t; i++){
        solve();
            }                                                            
    return 0;
}
//
//#ifdef ONLINE_JUDGE
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#endif

#include <bits/stdc++.h>

#include <utility>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
typedef long double ld;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//using ll = long long;
//#ifdef __int128
//using hll = __int128;
//#endif
//using pii = pair<ll, ll>;
//using ld = long double;

template <typename T>
void do_uniq(vector<T> &vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#ifndef ONLINE_JUDGE

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << endl;
}
#endif


#ifdef _getchar_nolock
#else
#    define _getchar_nolock getchar_unlocked
#endif

#define integer ll

integer mod = 1e9 + 7;

integer ml(integer a, integer b) {
    return (a * 1ll * b) % mod;
}

integer add(integer a, integer b) {
    return (a + b) % mod;
}

integer sub(integer a, integer b) {
    return add(a, mod - b);
}

integer sq(integer a) {
    return ml(a, a);
}

integer b_p(integer b, integer p) {
    if (p == 0) return 1;
    if (p & 1) return ml(b, b_p(b, p - 1));
    return sq(b_p(b, p >> 1));
}

int gcd(int x, int y){
    return y == 0 ? x : gcd(y, x % y);
}

#define solvsh
//#define multi

#ifdef solvsh

//#define int ll

const int MAXN = 5e3 + 32;

void solve() {


    int n;
    cin >> n;

    vector<int> v;

    for (int i = 0; i < n; ++i) {
        int curr;
        cin >> curr;
        v.push_back(curr);
    }

    ll mmx = 0;
    ll pref = 0;
    ll add = 0;

    for (int i = 0; i < n; ++i) {
        mmx = max(mmx, 0ll + v[i]);
        ll answr = (i + 1) * mmx;
        pref += v[i];
        add += pref;
        answr += add;

        cout << answr << "\n";
    }
}


#else

#endif


void multisolve() {

#ifndef ONLINE_JUDGE
    freopen("../input.in", "r", stdin);
#endif

    int t;

    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case #" << i << ": ";
        solve();
//        i++;
    }
}

#ifndef ONLINE_JUDGE

void gen() {
#ifndef ONLINE_JUDGE
    freopen("../input.in", "w", stdout);
#endif

}


#endif

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(20);

#ifdef multi
//    gen();
    multisolve();
//    checkk();
#else

    solve();
#endif
//     time_calc();
}
