#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
class Combination {
 public:
  const int max;
  const int mod;
  vector<long long> fac, finv, inv;
  Combination(int max, int mod)
      : max(max), mod(mod), fac(max), finv(max), inv(max) {
    init();
  }
  long long com(int n, int k) {
    if (n < k) return 0LL;
    if (n < 0 || k < 0) return 0LL;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
  }

 private:
  void init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < max; i++) {
      fac[i] = fac[i - 1] * i % mod;
      inv[i] = mod - inv[mod % i] * (mod / i) % mod;
      finv[i] = finv[i - 1] * inv[i] % mod;
    }
  }
};
Combination *c;
const int MOD = 1000000007;
const int MAX_N = 100000;
vector<long long> x;
int main(void) {
  c = new Combination(2 * MAX_N, MOD);
  long long N;
  cin >> N;
  x.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  long long acc = 0;
  for (int i = 1; i <= N - 1; i++) {
    long long v = 0;
    for (int j = 1; j <= i; j++) {
      v = (v + (c->fac[N - 1] * c->finv[j] % MOD) * c->fac[j - 1] % MOD) % MOD;
    }
    long long d = x[i] - x[i - 1];
    acc = (acc + (v * d % MOD)) % MOD;
  }
  cout << acc << endl;
  delete (c);
  return 0;
}
