#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;

int main(){
    int n; cin >> n;
    vl a(n),m(n,0),ans(n,0),sum(n,0),sum2(n,0);
    ll  tmpmax = 0;

    for(int ix=0;ix<n;ix++){
        cin >> a[ix];
        tmpmax = max(a[ix],tmpmax);
        if(ix == 0) {m[ix] = a[ix]; sum[ix] = a[ix]; sum2[ix] = 0;}
        else {m[ix] = max(a[ix],m[ix-1]); sum[ix] = sum[ix-1] + a[ix]; sum2[ix] = sum2[ix-1] + sum[ix-1];}
    }
    /*
    for(auto x : sum) cout << x << endl;
    cout << endl;

    for(auto x : sum2) cout << x << endl;
    cout << endl;
    */
    for(int ix=0;ix<n;ix++){
        if(ix == 0) ans[ix] = sum[ix] + m[ix];
        else{
            ans[ix] = sum[ix] + (ix+1)*m[ix] + sum2[ix];
        }
    }
    for(auto x : ans) cout << x << endl;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n{};
    cin>>n;
    vector <long long int> a(n+1),sum(n+1);
    for (int i{1};i<=n;i++){
        cin>>a.at(i);
        sum.at(i) = sum.at(i-1) + a.at(i);
    }
    long long int max{a.at(0)},sum1{};
    for (int i{1};i<=n;i++){
        if (max < a.at(i)){
            sum1 += (i-1)*(a.at(i) - max);
            max = a.at(i);
        }
        sum1 += max + sum.at(i);
        cout<<sum1<<endl;
    }
    return 0;
}