#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long modpow(long long x, int n) {
	long long r = 1;
	while (n > 0) {
		if (n&1) (r *= x) %= mod;
		n /= 2;
		(x *= x) %= mod;
	}
	return r;
}
long long modinv(long long x) {
	return modpow(x, mod-2);
}
int main() {
	int N;
	cin >> N;
	vector<long long> X(N);
	for (auto& x : X) cin >> x;
	long long aa = 1;
	for (int i = 2; i <= N-1; ++ i) aa = aa * i % mod;
	long long r = 0;
	for (int i = 0; i < N-1; ++ i) {
		r += (X[N-1] - X[i]) * aa % mod * modinv(i+1) % mod;
		r %= mod;
	}
	cout << r << endl;
}
