#include #include //#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 1e9 #define rep(i,n)for(int i=0;(i)<(int)(n);i++) #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++) #define VEC(type, c, n) std::vector c(n);for(auto& i:c)std::cin>>i; #define vec(type,n) vector(n) #define vvec(m,n) vector> (int(m),vector(n)) #define ALL(a) (a).begin(),(a).end() using namespace std; using ll = long long; using Graph = vector>; using P = pair; int main(){ int n; cin >> n; vector a(n); rep(i, n)cin >> a[i]; ll res = 0; rep(i, n){ cout << (i + 1) * (n - i) << endl; res += (a[i] * (i + 1) * (n - i)); } cout << res << endl; }