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

#define int long long
#define F first
#define S second

const int MOD = 1000 * 1000 * 1000 + 7;
int32_t main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a[n], dis[n], sum[n], fact[n + 10], inv[n + 10];
	fact[0] = fact[1] = 1;
	inv[0] = inv[1] = 1;
	for (int i = 2; i < n + 10; i++) {
		fact[i] = fact[i - 1] * i % MOD;
		inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
	}
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int ans = 0;
	sum[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		ans += ((sum[i] + i + 1) * inv[i + 1] % MOD * (a[i + 1] - a[i])) % MOD;
		sum[i + 1] = (sum[i] + (sum[i] + i + 1) * inv[i + 1] % MOD) % MOD;
	}
	ans %= MOD;
	cout << ans * fact[n - 1] % MOD;
}

