#include <bits/stdc++.h>
using namespace std;
long long n, ans;
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);
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;
}
long long add(long long &a, long long b) {
  a += b;
  if (a > MOD) a -= MOD;
  return a;
}
long long kakeru(long long a, long long b) { return a * b % MOD; }
long long kakeru(long long a, long long b, long long c) {
  return kakeru(kakeru(a, b), c);
}
long long f(long long a) {
  return kakeru(nCk(n - 1, a + 1), Factorial[n - a - 2], Factorial[a - 1]);
}
long long g(long long a) {
  return kakeru(nCk(n - 1, a), Factorial[n - a - 1], Factorial[a - 1]);
}
signed main() {
  Cinit();
  cin >> n;
  vector<long long> v(n), w(n + 1, 0);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < n; i++) w[i + 1] = v[i] + w[i];
  for (long long j = 1; j < n - 1; j++)
    add(ans, kakeru((w[n - 1] - w[n - j - 1]) - (w[j] - w[0]), f(j)));
  for (long long j = 1; j < n; j++)
    add(ans, kakeru(v[n - 1] - v[n - j - 1], g(j)));
  cout << ans << endl;
}
