#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long add(long long a, long long b) { return (a + b) % MOD; }
long long mul(long long a, long long b) { return (a * b) % MOD; }
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (auto &t : a) {
    cin >> t;
  }
  long long ans = 0;
  for (long long i = 0; i + 1 < n; i++) {
    long long d = (a[i + 1] - a[i]);
    long long in = 0;
    for (long long j = 1; j <= i + 1; j++) {
      in = add(in, binpow(j, MOD - 2));
    }
    ans = add(ans, mul(d, in));
  }
  for (long long i = 1; i <= n - 1; i++) {
    ans = mul(ans, i);
  }
  cout << ans << endl;
}
