#include using namespace std; using ll = long long; constexpr char newl = '\n'; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); ll ans = 0; for (int i = 0; i < n; i++) { cin >> a[i]; ans += (ll)(i + 1) * (n - i) * a[i]; } cout << ans << newl; return 0; }