#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
constexpr int MAX_N = 2000;
int n;
ll fact[MAX_N], rfact[MAX_N];
ll perm(ll n, ll r) { return (fact[n] * rfact[r]) % MOD; }
ll comb(ll n, ll r) { return (perm(n, r) * rfact[n - r]) % MOD; }
void init(ll n) {
  fact[0] = fact[1] = 1;
  rfact[0] = rfact[1] = 1;
  for (int i = 2; i <= n; ++i) {
    fact[i] = (fact[i - 1] * (ll)i) % MOD;
    rfact[i] = 1;
    ll k = MOD - 2;
    ll a = fact[i];
    while (k > 0) {
      if (k & 1) {
        rfact[i] *= a;
        rfact[i] %= MOD;
      }
      a *= a;
      a %= MOD;
      k >>= 1;
    }
  }
}
ll modpow(ll a, ll t) {
  ll ret = 1LL;
  while (t) {
    if (t & 1LL) {
      ret *= a;
      ret %= MOD;
    }
    a *= a;
    a %= MOD;
    t >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  vector<ll> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  if (n > MAX_N) assert(false);
  init(n);
  vector<ll> p(n, fact[n - 1]);
  p[0] = 0;
  for (int i = 1; i < n; ++i) {
    p[i] = p[i - 1] + (fact[n - 1] * modpow(i, MOD - 2)) % MOD;
  }
  ll ans = 0LL;
  for (int i = 1; i < n; ++i) {
    ans += ((a[i + 1] - a[i]) * p[i]) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
