#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

ll powMod(ll x, ll k) {
  if (k == 0) return 1;
  if (k % 2 == 0)
    return powMod(x * x % MOD, k / 2);
  else
    return x * powMod(x, k - 1) % MOD;
}

int main() {
  int N;
  cin >> N;
  vector<ll> x(N), a(N + 1);
  for (int i = 0; i < N; i++) cin >> x[i];

  ll ans = 0, fac = 1;
  for (int i = 1; i <= N - 1; i++) {
    fac *= i;
    fac %= MOD;
  }

  for (int i = 1; i <= N; i++) {
    a[i] = a[i - 1] + fac * powMod(i, MOD - 2);
    a[i] %= MOD;
  }

  for (int i = 0; i < N - 1; i++) {
    ans = (ans + (x[i + 1] - x[i]) * a[i + 1] % MOD) % MOD;
  }
  cout << ans << endl;
}