#include <bits/stdc++.h>
long long int fac[100001], finv[100001], inv[100001];
void MOD_COM_init() {
  fac[0] = 1;
  fac[1] = 1;
  finv[0] = 1;
  finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 100001; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
int main() {
  long long int n;
  scanf("%lld", &n);
  long long int x[n];
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &x[i]);
  }
  MOD_COM_init();
  long long int ans = 0;
  for (long long int i = 0; i <= n - 3; i++) {
    long long int q = 2, r = 3, t = 1;
    for (long long int j = i + 1; j <= n - 1; j++) {
      long long int len = x[j] - x[i];
      if (j == n - 1) {
        ans += len * t % 1000000007;
        ans = ans % 1000000007;
        break;
      }
      long long int ad = (len * ((t * inv[q]) % 1000000007) % 1000000007);
      t = t - ((t * inv[q]) % 1000000007);
      while (t < 0LL) {
        t += 1000000007;
      }
      ans += ad;
      ans = ans % 1000000007;
      q++;
    }
  }
  ans += (x[n - 1] - x[n - 2]);
  ans = ans % 1000000007;
  for (long long int i = 2; i <= n - 1; i++) {
    ans *= i;
    ans = ans % 1000000007;
  }
  printf("%lld", ans);
  return 0;
}
