#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;
using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
bool paircomp(const pair<ll, ll> &a, const pair<ll, ll> &b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
ll MODPOW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = MODPOW(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * MODPOW(n, m - 1)) % MOD;
  }
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
ll nCr(vl &f, ll n, ll r) {
  if (n < r) return 0LL;
  if (r > n / 2LL) r = n - r;
  ll res = (f[n] * MODPOW(f[n - r], MOD - 2LL)) % MOD;
  res = (res * MODPOW(f[r], MOD - 2LL)) % MOD;
  return res;
}
ll nHr(vl &f, ll n, ll m) { return nCr(f, n + m - 1, m); }
ll MODDIV(ll a, ll b) { return a * MODPOW(b, MOD - 2) % MOD; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl X(N);
  for (ll i = 0; i < (N); i++) cin >> X[i];
  vl M(2 * N + 1);
  M[0] = 1;
  for (ll i = (1); i < (2 * N); i++) M[i] = (M[i - 1] * i) % MOD;
  ll ans = 0;
  for (ll i = 0; i < (N - 1); i++) {
    for (ll j = (i + 1); j < (N - 1); j++) {
      ll po = (X[j] - X[i]) % MOD;
      po = (po * M[j - i - 1]) % MOD;
      po = (po * MODDIV(M[N - 1], M[j - i + 1])) % MOD;
      ans = (ans + po) % MOD;
    }
  }
  for (ll i = 0; i < (N - 1); i++) {
    ll j = N - 1;
    ll po = (X[j] - X[i]) % MOD;
    po = (po * M[j - i - 1]) % MOD;
    po = (po * MODDIV(M[N - 1], M[j - i])) % MOD;
    ans = (ans + po) % MOD;
  }
  cout << ans << endl;
  return 0;
}
