#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const long long MOD = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  if (n == 2) {
    cout << (x[1] - x[0]) % MOD << endl;
    return 0;
  }
  vector<long long> s(n + 1);
  s[0] = 0;
  for (int i = 0; i < n; i++) s[i + 1] = s[i] + x[i] - x[0];
  vector<long long> fac(n);
  fac[0] = 1;
  for (int i = 1; i < n; i++) {
    fac[i] = fac[i - 1] * i;
    fac[i] %= MOD;
  }
  long long ans1 = 0;
  for (int i = 0; i < n - 2; i++) {
    long long diff = (n - 2 - i) * (x[i] - x[0]);
    diff %= MOD;
    ans1 += s[n - 1] - s[i + 1] - diff;
    if (ans1 < 0) ans1 += MOD;
    ans1 %= MOD;
  }
  ans1 *= fac[n - 3];
  ans1 %= MOD;
  long long ans2 = 0;
  for (int i = 0; i < n - 1; i++) {
    long long tmp = fac[n - 2 - i] * fac[i + 1];
    tmp %= MOD;
    ans2 += (tmp * (x[n - 1] - x[i])) % MOD;
    ans2 %= MOD;
  }
  cout << (ans1 + ans2) % MOD << endl;
  return 0;
}
