#include <bits/stdc++.h>
using namespace std;
long long fact(long long n) {
  if (n <= 1)
    return 1;
  else
    return ((n % 1000000007) * fact(n - 1)) % 1000000007;
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a) { return modpow(a, 1000000007 - 2); }
int main(void) {
  long long n;
  cin >> n;
  long long inv[100000];
  long long x[100000];
  for (int i = 0; (i) < (n); i++) cin >> x[i];
  long long ans = 0;
  inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = -1ll * (1000000007 / i) * inv[1000000007 % i] % 1000000007;
  long long tmp = 0;
  for (int i = 0; (i) < (n - 1); i++) {
    tmp = (tmp + inv[i + 1]) % 1000000007;
    ans = (1ll * (x[i + 1] - x[i]) * tmp + ans) % 1000000007;
  }
  for (int i = 0; (i) < (n - 1); i++) ans = 1ll * ans * (i + 1) % 1000000007;
  cout << (ans + 1000000007) % 1000000007 << endl;
}
