#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rrep(i,n) for(int i=((n)-1);i>=0;--i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
#define mod 1000000007
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    int ans=0;
    rep(i,n){
        cin>>a[i];
        ans+=max(0,a[i]-10);
    }
    cout<<ans;
}
#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) == ma0) {
		ci += 9;
		return 10000000;
	}
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

const int MAX = 10000;
char C[MAX * 5];
char *dn = cn, * di = dn, * owad = dn + CM - 20;
void putint(ll A) {
	if (owad < di) {
		fwrite(dn, 1, di - dn, stdout);
		di = dn;
	}
	int dig = 1;
	if (A >= 10000000000000000) {
		if (A >= 100000000000000000) dig = 2;
		memcpy(di + 12 + dig, C + A % 10000 * 5, 5);
		A /= 10000;
		memcpy(di + 8 + dig, C + A % 10000 * 5, 4);
		A /= 10000;
		memcpy(di + 4 + dig, C + A % 10000 * 5, 4);
		A /= 10000;
		memcpy(di + dig, C + A % 10000 * 5, 4);
		memcpy(di, C + A / 10000 * 5 + 4 - dig, dig);
		di += 17 + dig;
	}
	else if (A >= 100000000) {
		if (A >= 1000000000000) {
			if (A >= 1000000000000000) dig = 4;
			else if (A >= 100000000000000) dig = 3;
			else if (A >= 10000000000000) dig = 2;
			memcpy(di + 8 + dig, C + A % 10000 * 5, 5);
			A /= 10000;
			memcpy(di + 4 + dig, C + A % 10000 * 5, 4);
			A /= 10000;
			memcpy(di + dig, C + A % 10000 * 5, 4);
			memcpy(di, C + A / 10000 * 5 + 4 - dig, dig);
			di += 13 + dig;
		}
		else {
			if (A >= 100000000000) dig = 4;
			else if (A >= 10000000000) dig = 3;
			else if (A >= 1000000000) dig = 2;
			memcpy(di + 4 + dig, C + A % 10000 * 5, 5);
			A /= 10000;
			memcpy(di + dig, C + A % 10000 * 5, 4);
			memcpy(di, C + A / 10000 * 5 + 4 - dig, dig);
			di += 9 + dig;
		}
	}
	else {
		if (A >= 10000) {
			if (A >= 10000000) dig = 4;
			else if (A >= 1000000) dig = 3;
			else if (A >= 100000) dig = 2;
			memcpy(di + dig, C + A % 10000 * 5, 5);
			memcpy(di, C + A / 10000 * 5 + 4 - dig, dig);
			di += 5 + dig;
		}
		else {
			if (A >= 1000) dig = 4;
			else if (A >= 100) dig = 3;
			else if (A >= 10) dig = 2;
			memcpy(di, C + A * 5 + 4 - dig, dig + 1);
			di += 1 + dig;
		}
	}
}
int A[200001];
ll S[200001];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	rep(i, MAX) {
		int X = i;
		rep(j, 4) {
			C[i * 5 + 3 - j] = '0' + X % 10;
			X /= 10;
		}
		C[i * 5 + 4] = '\n';
	}

	int N = getint();
	rep1(i, N) {
		A[i] = getint();
		S[i] = S[i - 1] + A[i];
		if (A[i - 1] > A[i]) A[i] = A[i - 1];
	}
	rep1(i, N - 1) S[i + 1] += S[i];

	rep1(i, N) putint(A[i] * ll(i) + S[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}