#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;
ll N;
ll x[101010];
ll fact[101010];
ll sum_dist;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  fact[1] = 1;
  for (int i = 2; i < 101000; i++) {
    fact[i] = (fact[i - 1] * i) % MOD;
  }
  sum_dist = ((x[N - 1] - x[0]) * fact[N - 1]) % MOD;
  for (int i = 1; i < N - 1; i++) {
    sum_dist +=
        ((x[N - 1] - x[i]) * (fact[N - 1] - (((N - 2) * (N - 1))) / 2)) % MOD;
    sum_dist %= MOD;
  }
  cout << sum_dist << endl;
}
