#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000 * 1000 * 1000 + 7;
long long mod(long long n) {
  n %= MOD;
  if (n < 0)
    return n + MOD;
  else
    return n;
}
long long fp(long long a, long long p) {
  long long ans = 1, c = a;
  for (long long i = 0; (1ll << i) <= p; ++i) {
    if ((p >> i) & 1) ans = mod(ans * c);
    c = mod(c * c);
  }
  return ans;
}
long long dv(long long a, long long b) { return mod(a * fp(b, MOD - 2)); }
const long long N = 1e5 + 7;
long long a[N];
long long inv[N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 0; i < N; ++i) inv[i] = fp(i, MOD - 2);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      long long len = a[j] - a[j - 1];
      ans += len * inv[j - i];
      ans %= MOD;
    }
  }
  for (long long i = 1; i <= n - 1; ++i) ans = ans * i % MOD;
  cout << ans << '\n';
}
