#include <bits/stdc++.h>
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vc = vector<char>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using psl = pair<string, ll>;
const ll MOD = 1e9 + 7;
ll pow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 0b01) {
      res *= a;
      res %= MOD;
    }
    a = a * a;
    a %= MOD;
    n >>= 1;
  }
  return res;
}
ll inv(ll num) { return pow(num, MOD - 2); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vl X = vl(N);
  for (int i = int(0); i < int(N); ++i) cin >> X[i];
  vl dx = vl(N - 1, 0);
  for (int i = int(0); i < int(N - 1); ++i) {
    dx[i] = X[i + 1] - X[i];
  }
  vector<ll> ec(N - 1, 0);
  for (int i = int(0); i < int(N - 1); ++i) {
    for (ll j = 1; j <= i + 1; j++) {
      ec[i] += inv(j);
      ec[i] %= MOD;
    }
  }
  ll ans = 0;
  for (int i = int(0); i < int(N - 1); ++i) {
    ans += dx[i] * ec[i];
    ans %= MOD;
  }
  for (int i = int(0); i < int(N - 1); ++i) {
    ans *= (i + 1);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
