#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[200010], s[200010] = {0}, ans[200010] = {0}, vis[200010] = {0}, n;
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		vis[i] = max(vis[i-1], a[i]);
		s[i] = s[i-1] + a[i];
	}
	for (int i = 1; i <= n; i++) {
		ans[i] = ans[i-1]+s[i];
		printf("%lld\n", ans[i]+i*vis[i]);
	}
	return 0;
}
#include <algorithm>
#include <bitset>
//#include <cmath>
//#include <complex>
#include <cctype>
#include <cstdio>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

int64_t INF = LLONG_MAX;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    
    vector<int> A(N);
    vector<int> maxA(N);
    int currentmax = 0;
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
        currentmax = max(A.at(i), currentmax);
        maxA.at(i) = currentmax;
    }
    
    vector<int64_t> memo(N);
    int64_t currentsum = 0;
    
    
    memo.at(0) = A.at(0) + currentmax;
    currentsum += memo.at(0);
    
    vector<int64_t> ans(N);
    for(int i = 1; i < N; i++){
        memo.at(i) = memo.at(i-1) + A.at(i);
        currentsum += memo.at(i);
    }
    
    ans.at(N-1) = currentsum;
    int tmp = 0;
    for(int i = N-1; i > 0; i--){
        currentsum -= memo.at(i) - tmp;
        if(maxA.at(i-1) < maxA.at(i)){
            currentsum -= (maxA.at(i) - maxA.at(i-1)) * i;
            tmp += (maxA.at(i) - maxA.at(i-1));
        }
        
        ans.at(i-1) = currentsum;
    }
    
    for(auto a: ans){
        cout << a << endl;
    }
    
    


    return 0;
}
