#include <bits/stdc++.h>
using namespace std;
long long exp(long long b, long long i) {
  if (i == 0) return 1;
  long long r = 1;
  long long e = exp(b, i / 2);
  if (i % 2 == 1) r *= b;
  r *= e;
  r %= (1000000007LL);
  r *= e;
  return r % (1000000007LL);
}
long long inv(long long x) { return exp(x, (1000000007LL) - 2); }
int main(void) {
  long long fact[100001];
  long long st[100001];
  long long f = 1;
  fact[0] = 1;
  st[0] = 0;
  for (long long i = 1; i <= 100001; i++) {
    f *= i;
    f %= (1000000007LL);
    fact[i] = f;
    st[i] = fact[i - 1] + st[i - 1] * i;
    st[i] %= (1000000007LL);
  }
  int N;
  cin >> N;
  if (N > 2000) return 0;
  vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  long long ans = 0;
  long long m = 0;
  for (int i = 0; i < N - 1; i++) {
    long long d = x[i + 1] - x[i];
    long long c = st[i + 1] * fact[N - 1];
    c %= (1000000007LL);
    c *= inv(fact[i + 1]);
    c %= (1000000007LL);
    ans += d * c;
    ans %= (1000000007LL);
  }
  cout << ans << endl;
  return 0;
}
