#include <bits/stdc++.h>
using namespace std;
class abc {
 public:
  long long int x, y;
};
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int mi(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int fac[600000 + 2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ::fac[0] = 1;
  for (long long int i = 1; i <= 600001; i++)
    ::fac[i] = (::fac[i - 1]) * i % 1000000007;
  long long int n;
  cin >> n;
  vector<long long int> arr(n);
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long int sub = 0;
  for (long long int i = 0; i < n - 1; i++) {
    sub += arr[i];
    sub %= 1000000007;
  }
  sub *= fac[n - 1];
  sub %= 1000000007;
  long long int add = 0;
  vector<long long int> v1(n - 1, 0);
  v1[0] = fac[n - 1] * mi(fac[2], 1000000007);
  v1[0] %= 1000000007;
  for (long long int i = 1; i < n - 2; i++) {
    v1[i] = v1[i - 1];
    long long int xd = fac[n - 1] * (mi(fac[i + 2], 1000000007));
    xd %= 1000000007;
    xd %= 1000000007;
    v1[i] += xd;
    v1[i] %= 1000000007;
  }
  long long int sum = 0;
  for (long long int i = 0; i < n - 2; i++) {
    sum += v1[i];
  }
  if (n - 3 >= 0) {
    v1[n - 2] = (n - 1) * fac[n - 1] - sum;
    if (v1[n - 2] < 0) {
      v1[n - 2] += 1000000007;
    }
  }
  for (long long int i = 1; i < n; i++) {
    add += (v1[i - 1] * (arr[i]));
    add %= 1000000007;
  }
  long long int ans = add - sub;
  if (ans < 0) {
    ans += 1000000007;
  }
  cout << ans << "\n";
}
