#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n, p;
  cin >> n;
  vector<long long int>v, somme, somme2;
  somme2.push_back(0);
  while(cin >> p){
    v.push_back(p);
    somme.push_back(v.back()+ (somme.size()!=0? somme.back(): 0));
  }
  long long int mx = 0;
  long long int ans = 0;
  for(size_t i=0; i<v.size(); i++){
    mx = max(mx, v.at(i));
    ans = (somme2.at(i) + mx*(i+1)) + somme.at(i);
    somme2.push_back(somme2.at(i)+somme.at(i));
    cout << ans << endl;
  }
  return 0;
}
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
const int MaxA = 200;
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> d(MaxA* 2 + 1);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        for(int aj = -MaxA; aj <= MaxA; aj++){
            int c = d[MaxA + aj];
            int x = a[i] - aj;
            ans += (ll)x * x * c;
        }
        d[MaxA+a[i]]++;
    }
    cout << ans << endl;
    return 0;
}
