#include #define all(x) (x).begin(), (x).end() typedef long long ll; #define MOD 1000000007 using namespace std; int main() { ll n; cin >> n; vector a(n + 1, 0); for(int i = 1; i <= n; i++) { cin >> a[i]; } ll ans = 0; for(int i = 1; i <= n; i++) { ans += a[i] * i * (n - i + 1); } cout << ans << endl; }