#include using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vectorv(n); for (int i = 0; i < n; i++) { cin >> v[i]; } ll sum = 0; for (int i = 0; i < n; i++) { ll left = (i + 1); ll right = (n - i); sum += v[i] * (right * left); } cout << sum << endl; }