#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 11;
const int mod = 1e9 + 7;
int n;
long long x[N], pre[N], suf[N], D[N];
int fac[N], inv[N];
int read() {
  int x = 0, fl = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') fl = (ch == '-' ? -1 : fl), ch = getchar();
  while (ch >= '0' && ch <= '9') x = 10 * x + ch - 48, ch = getchar();
  return x * fl;
}
inline int M(int x, int y) { return 1LL * x * y % mod; }
inline int A(int x, int y) { return x + y - (x + y >= mod ? mod : 0); }
inline int C(int n, int m) {
  if (n > m) return 0;
  return M(fac[m], M(inv[n], inv[m - n]));
}
int main() {
  inv[0] = inv[1] = fac[1] = fac[0] = 1;
  for (int i = 2; i <= 1e5; i++) {
    fac[i] = M(fac[i - 1], i);
    inv[i] = mod - M(mod / i, inv[mod % i]);
  }
  for (int i = 1; i <= 1e5; i++) {
    inv[i] = M(inv[i], inv[i - 1]);
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    x[i] = read();
    pre[i] = pre[i - 1] + x[i];
  }
  for (int i = n - 1; i >= 1; i--) {
    suf[i] = suf[i + 1] + x[i];
  }
  int ans = 0;
  for (int k = 1; k <= n - 2; k++) {
    D[k] = suf[k + 1] - pre[n - 1 - k];
    D[k] %= mod;
    ans = A(ans,
            M(C(k + 1, n - 1), M(fac[k - 1], M(D[k], fac[n - 1 - (k + 1)]))));
  }
  for (int i = 1; i <= n - 1; i++) {
    ans = A(ans,
            M(fac[n - i - 1], M(fac[i - 1], M(C(n - i, n - 1), x[n] - x[i]))));
  }
  cout << ans << endl;
  return 0;
}
