#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(void){
	int N,*A,a,score=0,k;
	int *max_num;//数字Anの大きい順に配列の場所が収納される
	int *space;//そこが空いているかどうかを見るだけ(空きなら0)
	int i,j,buff1,buff2;
	char str[10000];
 
	fgets(str, sizeof(str), stdin);
	N=atoi(strtok(str," "));
	
	A = (int*)calloc(N,sizeof(int));
	max_num = (int*)calloc(N,sizeof(int));
	space = (int*)calloc(N,sizeof(int));

	fgets(str, sizeof(str), stdin);	
	A[0]=atoi(strtok(str," "));
	for(i=1;i<N;i++){
		A[i]=atoi(strtok(NULL," "));
		for(j=0;j<i;j++){
			if( A[max_num[j]] < A[i] ){
				buff1 = max_num[j];
				max_num[j] = i;
				j++;
				break;
			}
		}
		for(;j<i;j++){
			buff2 = max_num[j];
			max_num[j] = buff1;
			buff1=buff2;
		}
		max_num[j] = buff1;
	}

	for(i=0;i<N;i++){
		k = max_num[i];
		if( (k+1) <= N/2){//半分より前か
			for(j=N-1;(j-k)>k;j--){
				if (space[j]==0){//奥
					score+=(j-k)*A[k];
					space[j]=1;
					j=0;
					break;
				}
			}
			for(;j>k;j--){
				if (space[j]==0){//奥
					score+=(j-k)*A[k];
					space[j]=1;
					break;
				}else if(space[2*k-j]==0){//手前
					score+=(k-j)*A[k];
					space[j]=1;
					break;
				}
			}
		}else{//半分より後ろなら
			for(j=0;(k-j)>j;j++){
				if (space[j]==0){//手前
					score+=(k-j)*A[k];
					space[j]=1;
					j=k;
					break;
				}
			}
			for(;j<k;j++){
				if (space[j]==0){//手前
					score+=(k-j)*A[k];
					space[j]=1;
					break;
				}else if(space[2*k-j]==0){//奥
					score+=(j-k)*A[k];
					space[j]=1;
					break;
				}
			}
		}
		printf("%d \n",score);
	}




	free(A);
	free(max_num);
	free(space);

	return 0;
}