#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;
long long powMod(long long x, long long n) {
  if (n == 0) return 1;
  long long r = powMod(x, n / 2);
  if (n % 2 == 0) return (r * r) % MOD;
  return (r * r % MOD) * x % MOD;
}
int main(void) {
  long long n;
  cin >> n;
  long long x[100010];
  for (int i = 0; i < int(n); i++) cin >> x[i + 1];
  long long f[100010], s[100010];
  f[1] = ((n - 1) * (n - 2) / 2) % MOD;
  for (long long i = 1; i <= n - 3; i++) {
    f[1] *= i;
    f[1] %= MOD;
  }
  for (long long i = 1; i <= n - 3; i++) {
    f[i + 1] = (f[i] * i % MOD);
    f[i + 1] *= n - i - 1;
    f[i + 1] %= MOD;
    f[i + 1] *= n - i - 2;
    f[i + 1] %= MOD;
    f[i + 1] *= powMod(i + 2, MOD - 2);
  }
  s[1] = f[1];
  for (int i = 1; i < n - 2; i++) {
    s[i + 1] = s[i] + f[i + 1];
    s[i + 1] %= MOD;
  }
  long long a = 0;
  for (int i = 1; i <= n - 2; i++) {
    a += (x[i + 1] * s[i]) % MOD;
    a %= MOD;
  }
  long long b = 0;
  for (int i = 1; i <= n - 1; i++) {
    b += (x[i] * s[n - i - 1]) % MOD;
    b %= MOD;
  }
  long long g[100010];
  g[1] = 1;
  for (long long i = 1; i <= n - 2; i++) {
    g[1] *= i;
    g[1] %= MOD;
  }
  for (long long i = 1; i <= n - 2; i++) {
    g[i + 1] = (g[i] * i % MOD);
    g[i + 1] *= n - i;
    g[i + 1] %= MOD;
    long long d = (n - i - 1) * (i - 1) % MOD;
    if (i - 1 == 0) continue;
    g[i + 1] *= powMod(d, MOD - 2);
    g[i + 1] %= MOD;
  }
  long long c = 0;
  for (int i = 1; i <= n - 1; i++) {
    c += (x[n] - x[i]) * g[i];
    c %= MOD;
  }
  long long ans = c + a - b;
  ans %= MOD;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
