#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y))
#define chmax(x,y) x = max((x),(y))
#define popcount(x) __builtin_popcount(x)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    ll ans = 2*a[0];
    ll last = 2*a[0];
    ll ma = a[0];
    //cout << last << endl;
    cout << ans << endl;
    for(int i=1;i<n;i++){
        if(ma < a[i]){
            ans += i*(a[i]-ma) + last+(a[i]-ma)+a[i];
            last = last+(a[i]-ma)+a[i];
            ma = a[i];
        }else{
            ans += last+a[i];
            last += a[i];
        }
        //cout << last << endl;
        cout << ans << endl;
    }
    return 0;
}
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
long long k;
long long a[3000006];
long long sum[3000006];
int main(){
	scanf("%d%lld",&n,&k);
	int l=3;
	for(int i=1;i<=n;++i)a[l++]=1ll*i;
	for(int i=n-1;i>=1;--i)a[l++]=1ll*i;
	for(int i=3;i<=n+2;++i){
		sum[i]=sum[i-1]+a[i];
		a[i]=sum[i];
	}
	for(int i=n+3;i<=3*n;++i){
		sum[i]=sum[i-1]+a[i];
		a[i]=(sum[i]-sum[i-n]);
	}
	for(int s=3;s<=3*n;++s){
		if(k<=a[s]){
			for(int i=1;i<=min(s-2,n);++i){
				int js;
				if(s-i-1<=n)js=s-i-1;
				else js=max(2*n-(s-i-1),0);
				if(k<=js){
					int j=k+(s-i-1>n?s-i-1-n:0);
					printf("%d %d %d\n",i,j,(s-i-j));
					return 0;
				}
				k-=1ll*js;
			}
		}
		k-=a[s];
	}
	return 0;
}
