#include <bits/stdc++.h>
using namespace std;
long long x[100000];
const long long MOD = 1000000007;
long long pow(long long m, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = (res * m) % MOD;
    }
    m = (m * m) % MOD;
    n >>= 1;
  }
  return res;
}
long long inverse(long long a) { return pow(a, MOD - 2); }
int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  long long n_fact = 1;
  for (int i = 1; i < N; i++) {
    n_fact = (n_fact * (long long)i) % MOD;
  }
  long long ans = 0;
  long long diff_sum = 0;
  for (int i = N - 2; i >= 0; i--) {
    diff_sum = (diff_sum + ((x[i + 1] - x[i]) * (N - 1 - i)) % MOD) % MOD;
    ans = (ans + (diff_sum * inverse(N - i - 1)) % MOD) % MOD;
  }
  cout << (ans * n_fact) % MOD << endl;
  return 0;
}
