#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
int ctoi(char c) {
  switch (c) {
    case '0':
      return 0;
    case '1':
      return 1;
    case '2':
      return 2;
    case '3':
      return 3;
    case '4':
      return 4;
    case '5':
      return 5;
    case '6':
      return 6;
    case '7':
      return 7;
    case '8':
      return 8;
    case '9':
      return 9;
    default:
      return 0;
  }
}
bool pairCompare(const pll firstElof, pll secondElof) {
  return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
ll i, j, k, l, m, n;
ll N, M, K, H, W, L;
string S;
ll MOD = 1000000007;
ll ans = 0;
ll INF = 9999999999999;
vl flag, color;
vll path;
vl A, T;
ll key = 0;
int main() {
  cin >> N;
  vl X(N);
  for (i = 0; i < N; i++) {
    cin >> X[i];
  }
  if (N == 2) {
    cout << (X[1] - X[0]) % MOD;
  } else {
    ll value = -1;
    if (N <= 3) {
      value++;
    }
    for (i = N - 2; i <= N; i++) {
      if (i == 1) continue;
      value = (value + (i) * (X[i - 1] - X[i - 2])) % MOD;
    }
    ans = value;
    for (i = 3; i <= N - 1; i++) {
      ans = (ans * i) % MOD;
    }
    cout << ans;
  }
}
