#include <bits/stdc++.h>
using namespace std;
long long BE(long long b, long long e) {
  long long r = 1;
  while (e) {
    if (e & 1) {
      r = (r * b) % 1000000007;
    }
    b = (b * b) % 1000000007;
    e >>= 1;
  }
  return r;
}
long long fact(long long x) {
  long long k = 1;
  for (long long i = 1; i <= x; i++) {
    k = (k * i) % 1000000007;
  }
  return k;
}
signed main(void) {
  long long N;
  long long x[114514];
  cin >> N;
  for (long long i = 0; i < (N); ++i) {
    cin >> x[i];
  }
  long long d[114514];
  d[0] = fact(N - 1);
  for (long long i = 0; i < (N - 1); ++i) {
    if (i == 0) continue;
    long long c = d[i - 1];
    c *= i;
    c %= 1000000007;
    c *= BE(i + 1, 1000000007 - 2);
    c %= 1000000007;
    d[i] = c;
  }
  for (long long i = 0; i < (N - 1); ++i) {
    d[N - 1] += d[i];
    d[i] = 1000000007 - d[i];
  }
  long long Ans = 0;
  for (long long i = 0; i < (N); ++i) {
    Ans += x[i] * d[i];
    Ans %= 1000000007;
  }
  cout << Ans << endl;
  return 0;
}
