#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007

int n;
long long fa[100005], fb[100005], fc[100005], la, ans;

int main() {
	scanf("%d", &n);
	fa[0] = 1;
	for (int i = 1; i < n; i++)
		fa[i] = fa[i - 1] * i % MOD;
	fb[n - 1] = 1;
	for (int i = n - 1; i; i--)
		fb[i - 1] = fb[i] * i % MOD;
	for (int i = 1; i < n; i++)
		fc[i] = (fc[i - 1] + fa[i - 1] * fb[i]) % MOD;
	scanf("%lld", &la);
	for (int i = 1; i < n; i++) {
		long long tmp;
		scanf("%lld", &tmp);
		// printf("%lld %lld\n", tmp - la, fc[i]);
		ans = (ans + (tmp - la) * fc[i]) % MOD;
		la = tmp;
	}
	printf("%lld\n", ans);
}