#include <bits/stdc++.h>
using namespace std;
const long long ZERO = 0;
const long long INF = 1e14;
const long long MOD = 1000000007;
const double PI = 3.1415926535897;
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
int main() {
  int N;
  cin >> N;
  vector<long long> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  vector<long long> d(N - 1);
  for (int i = 0; i < N - 1; i++) {
    d.at(i) = vec.at(i + 1) - vec.at(i);
  }
  reverse(d.begin(), d.end());
  long long cnt = 3;
  long long as = 2;
  for (long long i = 3; i <= N - 1; i++) {
    cnt = cnt * i + as;
    cnt %= MOD;
    as = as * i % MOD;
  }
  long long a = 1;
  for (int i = 1; i <= N - 2; i++) {
    a = (a * i) % MOD;
  }
  long long b = N - 2;
  long long ret = 0;
  for (int i = 0; i < N - 1; i++) {
    ret += d.at(i) * cnt;
    ret %= MOD;
    if (cnt <= a) {
      cnt = (cnt + MOD) - a;
    } else {
      cnt -= a;
    }
    if (i == N - 2) {
      break;
    }
    a = (a * (b + 1) * modinv(b, MOD)) % MOD;
    b--;
  }
  cout << ret << endl;
}
