#include <bits/stdc++.h>
using namespace std;
long long n, a, previ, ans = 0;
signed main() {
  long long perm = 1;
  cin >> n;
  vector<long long> A(n);
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  vector<long long> s(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    s[i + 1] = s[i] + A[i];
    if (i > 0) ans += s[i + 1] - s[i];
  }
  for (long long i = 0; i < n - 2; i++) {
    perm *= (i + 1);
    perm %= 1000000007;
  }
  cout << (ans * perm) % 1000000007 << endl;
}
