#include<bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << "=" << x << endl
//------------------------------------------------------------

void solve(){
    int n;
    cin >> n;
    int A[n];
    for (auto &it: A) cin >> it;

    int P[n+1] = {0}, PP[n+1] = {0};
    int emax = A[0];

    for (int i=0; i<n; ++i){
        P[i+1] = P[i] + A[i];
    }
    
    for (int i=0; i<n; ++i){
        PP[i+1] = PP[i] + P[i+1];
    }
    // for (auto m: PP) cout << m << ' ';
    for (int i=1; i<=n; ++i){
        emax = max(emax, A[i-1]);
        int ans = i*emax + PP[i];
        cout << ans << '\n';
    }

}


int32_t main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int t = 1;
    // cin >> t;

    while (t--){
        solve();
    }
}


// ------------------------------------------------------------
//
//#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();
}
