#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
long long x[100005];
long long frac[100005];
long long reFrac[100005];
void preWork(int n) {
  reFrac[n + 1] = 1ll;
  for (int i = n; i >= 1; i--) reFrac[i] = (long long)i * reFrac[i + 1];
  frac[0] = 1ll;
  long long hold = 1ll;
  for (int i = 1; i <= n; i++) {
    frac[i] = hold * reFrac[i + 1] % mod;
    hold = hold * i % mod;
  }
}
long long pow(long long a, long long b) {
  long long res = 1ll;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return res;
}
long long inv(long long u) { return pow(u, mod - 2ll); }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  preWork(n - 1);
  long long ans = 0;
  long long sumLen = 0;
  for (int i = n - 1; i >= 1; i--) {
    sumLen = (sumLen + x[i + 1]) % mod;
    long long add =
        ((sumLen - (long long)(n - i) * x[i] % mod) % mod + mod) % mod;
    long long mul = frac[n - i];
    ans = (ans + add * mul % mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
