#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long pw(long long n, long long k) {
  if (k < 0) return pw(n, k + MOD - 1);
  long long res = 1;
  while (k) {
    if (k & 1) res *= n;
    res %= MOD;
    n *= n;
    n %= MOD;
    k >>= 1;
  }
  return res;
}
std::vector<long long> Factorial(5e6), Finverse(5e6);
inline void Cinit() {
  Factorial[0] = 1;
  for (long long i = 1; i < 5e6; i++) Factorial[i] = Factorial[i - 1] * i % MOD;
  for (long long i = 0; i < 5e6; i++) Finverse[i] = pw(Factorial[i], MOD - 2);
}
long long nCk(long long n, long long k) {
  if (n < k) return 0;
  if (k < 0) return 0;
  if (!Factorial[0]) Cinit();
  long long res = Factorial[n];
  res *= Finverse[k];
  res %= MOD;
  res *= Finverse[n - k];
  res %= MOD;
  return res;
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  vector<long long> w(n + 1, 0);
  for (long long i = 0; i < n; i++) w[i + 1] = v[i] + w[i];
  long long ans = 0;
  long long L = nCk(1, 1);
  for (long long j = 1; j < n - 1; j++) {
    long long A = w[n] - w[n - j] - (w[j] - w[0]);
    A %= MOD;
    A += MOD;
    A %= MOD;
    A -= v[n - 1] - v[n - 1 - j];
    A += MOD;
    A *= Factorial[j - 1];
    A %= MOD;
    A *= Factorial[n - 1 - (j + 1)];
    A *= nCk(n - 1, j + 1);
    A %= MOD;
    ans += A;
    ans %= MOD;
    A = v[n - 1] - v[n - 1 - j];
    A *= nCk(n - 1, j);
    A %= MOD;
    A *= Factorial[j - 1];
    A %= MOD;
    A *= Factorial[n - 1 - j];
    A %= MOD;
    ans += A;
    ans %= MOD;
  }
  long long j = n - 1;
  long long A = v[n - 1] - v[n - 1 - j];
  A *= nCk(n - 1, j);
  A %= MOD;
  A *= Factorial[j - 1];
  A %= MOD;
  A *= Factorial[n - 1 - j];
  A %= MOD;
  ans += A;
  ans %= MOD;
  cout << ans << endl;
}
