#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N; cin >> N; ll ans = 0; rep(ii, 0, N) { ll i = ii; ll A; cin >> A; ans += A * (i + 1) * (N - i); } cout << ans << '\n'; }