#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long inf = 1e18;
long long N;
long long x[100010];
long long sum_x[100010];
long long factrial[100010], inverse[100010], sum, ans;
long long fast_pow(long long a, long long b) {
  long long ret = 1;
  if (a < 0) {
    a = -a;
    if (b % 2 == 1) ret = -1;
  }
  while (b > 0) {
    if (b & 1) {
      ret *= a;
    }
    a *= a;
    a %= mod;
    ret %= mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  cin >> N;
  for (long long i = (0); i < (N); i++) {
    cin >> x[i];
  }
  factrial[0] = 1;
  inverse[0] = 1;
  for (int i = 1; i <= N; i++) {
    factrial[i] = (factrial[i - 1] * i) % mod;
    inverse[i] = fast_pow(factrial[i], mod - 2) % mod;
  }
  for (long long i = (0); i < (N - 1); i++) {
    sum_x[i + 1] = sum_x[i] + ((factrial[N - 1] * factrial[N - i - 2] % mod) *
                               inverse[N - i - 1]) %
                                  mod;
    sum_x[i + 1] %= mod;
  }
  for (long long i = (1); i < (N); i++) {
    long long now = sum_x[N - i] * i;
    now %= mod;
    now *= (x[N - i] - x[N - i - 1]);
    now %= mod;
    ans += now;
    ans %= mod;
  }
  cout << (ans) << endl;
  return 0;
}
