#include <bits/stdc++.h>

#define lli long long int
#define ii pair<int, int>
#define ll pair<lli, lli>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second

using namespace std;

lli bigmod = 1000000007;

lli fex(lli a, lli b) {
	lli ret;
	if (b == 0)
		return 1;
	ret = fex(a, b / 2);
	ret = (ret * ret) % bigmod;
	if (b & 1)
		ret = (ret * a) % bigmod;
	return ret;
}

int main() {
	lli n, x[100005], f, dist, temp, ans = 0, mul = 0;
	scanf("%lld", &n);
	f = 1;
	for (lli i = 2; i < n; i++)
		f = (f * i) % bigmod;
	for (lli i = 0; i < n; i++)
		scanf("%lld", &x[i]);
	for (lli i = 1; i < n; i++) {
		dist = x[i] - x[i - 1];
		temp = (f * fex(i, bigmod - 2)) % bigmod;
		mul = (mul + temp) % bigmod;
		temp = (mul * dist) % bigmod;
		ans = (ans + temp) % bigmod;
	}
	printf("%lld\n", ans);
	return 0;
}