#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int MOD = 1000000000 + 7;
template <typename tuple<long long, long long, long long> >
inline string toString(const tuple<long long, long long, long long> &a) {
  ostringstream oss;
  oss << a;
  return oss.str();
};
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
const long long mod = 1000000000 + 7;
long long modfact(long long n) { return n < 2 ? 1 : modfact(n - 1) * n % mod; }
long long x[100010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> x[i];
  long long p = modfact((long long)(n - 1));
  long long ans = 0;
  for (int i = 0; i < (n - 1); i++) {
    ans = (ans + (p * (x[n - 1] - x[i]) % mod) *
                     modpow((long long)(n - i - 1), mod - 2, mod) % mod) %
          mod;
  }
  for (int i = 0; i < (n - 2); i++) {
    for (int l = 1; l <= n - i - 2; ++l) {
      ans =
          (ans + (p * (x[i + l] - x[i]) % mod) *
                     modpow((long long)l * (l + 1) % mod, mod - 2, mod) % mod) %
          mod;
    }
  }
  cout << ans << endl;
}
