#include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
int64 modpow(int64 n, int64 r) {
  if (r == 0) return 1;
  if (r % 2 == 0) {
    int64 x = modpow(n, r / 2);
    return x * x % MOD;
  } else {
    return modpow(n, r - 1) * n % MOD;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 n;
  cin >> n;
  vector<int64> x(n);
  for (int64 i = 0; i < (n); ++i) cin >> x[i];
  vector<int64> factorial(n + 1);
  factorial[0] = 1;
  for (int64 i = (1); i < (n + 1); i++) {
    factorial[i] = factorial[i - 1] * i % MOD;
  }
  vector<int64> revFactorial(n + 1);
  revFactorial[n] = modpow(factorial[n], MOD - 2);
  for (int64 i = (n - 1); i >= (0); i--) {
    revFactorial[i] = revFactorial[i + 1] * (i + 1) % MOD;
  }
  int64 ans = 0;
  for (int64 i = 0; i < (n - 2); ++i) {
    ans -= x[i] * revFactorial[n - 1 - i - 1] % MOD * revFactorial[n - i - 1] %
           MOD * factorial[n - 1] % MOD;
    ans = (ans % MOD + MOD) % MOD;
  }
  for (int64 j = (1); j < (n - 1); j++) {
    ans += x[j] * revFactorial[j] % MOD * revFactorial[j + 1] % MOD *
           factorial[n - 1] % MOD;
    ans %= MOD;
  }
  for (int64 i = 0; i < (n - 1); ++i) {
    int32 a = n - 2 - i, b = i;
    ans += (x[n - 1] - x[i]) * factorial[a] % MOD * revFactorial[a + 1] % MOD *
           factorial[n - 1] % MOD;
    ans %= MOD;
  }
  cout << (ans) << "\n";
  return 0;
}
