#include using namespace std; using ll = long long; int main() { int n; cin >> n; vector a(n); for(int i = 0; i < n; i++)cin >> a[i]; ll sum = 0; for(int i = 0; i < n; i++) { ll cur = (i + 1) * (n - i); sum += a[i] * cur; } cout << sum << endl; } // 1 2 3 4