#include <bits/stdc++.h>
using namespace std;

#define MOD (1000000000+7)

long long power( long long x, long long n )
{
	long long res = 1;
	while( n > 0 ) {
		if( n % 2 ) res = res * x % MOD;
		x = x * x % MOD;
		n /= 2;
	}
	return res;
}

int main()
{
	int N;
	cin >> N;
	vector<long long> x( N );
	for( int i = 0; i < N; i++ ) {
		cin >> x[i];
	}

	long long fac = 1;
	for( int i = 2; i < N; i++ ) {
		fac *= i;
		fac %= MOD;
	}
	vector<long long> p( N );
	p[0] = fac;
	for( int i = 1; i < N; i++ ) {
		p[i] = p[i - 1] + fac * power( i + 1, MOD - 2 ) % MOD;
		p[i] %= MOD;
	}
	long long ans = 0;
	for( int i = 0; i < N - 1; i++ ) {
		ans += (x[i + 1] - x[i]) * p[i] % MOD;
		ans %= MOD;
	}

	cout << ans << endl;
}
