#include <bits/stdc++.h>
int main(void) {
  int N, *A, a, score = 0, k;
  int *max_num;
  int *space;
  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;
}
