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