#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
long long extGCD(long long a, long long mod, long long &x, long long &y) {
  if (mod == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extGCD(mod, a % mod, y, x);
  y -= (a / mod) * x;
  return d;
}
long long invmod(long long a, long long mod) {
  long long x, y;
  extGCD(a, mod, x, y);
  x %= mod;
  if (x < 0) x += mod;
  return x;
}
long long fac[200010], finv[200010], inv[200010];
void combinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = (2); i < (200010); i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = invmod(i, mod);
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long comb(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main() {
  long long n;
  cin >> n;
  combinit();
  vector<long long> x(n);
  for (int i = (0); i < (n); i++) cin >> x[i];
  long long k = 1;
  for (int i = (1); i < (n); i++) {
    k *= i;
    k %= inf;
  }
  vector<long long> a(n - 1);
  a[0] = k;
  for (int i = (1); i < (n - 1); i++) {
    k = k * i % inf;
    k *= inv[i + 1] % inf;
    a[i] = a[i - 1] + k;
    a[i] %= inf;
  }
  vector<long long> b(n);
  for (int i = (0); i < (n - 1); i++) {
    b[i] = x[i + 1] - x[i];
  }
  long long ans = 0;
  for (int i = (0); i < (n - 1); i++) {
    ans += (a[i] * b[i]) % inf;
    ans %= inf;
  }
  if (ans < 0) ans += inf;
  cout << ans << endl;
}
