#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long mod_c[1000000 + 1], mod_r[1000000 + 1], mod_d;
long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
void comb() {
  if (mod_d == 0) {
    long long i;
    mod_c[0] = 1;
    mod_r[0] = 1;
    for (i = 1; i <= 1000000; i++) {
      mod_c[i] = mod_c[i - 1] * i % 1000000007;
    }
    for (i = 1; i <= 1000000; i++) {
      mod_r[i] = mod_pow(mod_c[i], 1000000005, 1000000007);
    }
    mod_d = 1;
  }
}
long long nck(long long n, long long k) {
  comb();
  long long res = 1;
  res = res * mod_c[n] % 1000000007;
  res = res * mod_r[k] % 1000000007;
  res = res * mod_c[k - 1] % 1000000007;
  res %= 1000000007;
  return res;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  long long nb = 1;
  long long ans = 0;
  comb();
  long long mod = 1000000007;
  for (int i = 0; i < n - 1; i++) {
    if (i >= 1) {
      ans += (x[i + 1] - x[i]) * (mod_c[n - 1] + nck(n - 1, i + 1)) % mod;
    } else {
      ans += (x[i + 1] - x[i]) * (mod_c[n - 1]);
    }
    ans %= 1000000007;
  }
  cout << ans << endl;
}
