#include #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { ll N, A, ans = 0; cin >> N; rep(i, N) { cin >> A; ans += A * (i + 1) * (N - i); } cout << ans << "\n"; }