#include <bits/stdc++.h>
using namespace std;
const int MAXN=100010,P=1e9+7;
int n,ans,x[MAXN],inv[MAXN];
int qpow (int a,int b) {
	int res=1;
	while (b) {
		if (b&1) {res=(1ll*res*a)%P;}
		a=(1ll*a*a)%P,b>>=1;
	}
	return res;
}
int main () {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {scanf("%d",&x[i]);}
	for (int i=1;i<=n;i++) {inv[i]=qpow(i,P-2);}
	for (int i=1;i<=n-1;i++) {ans=(ans+(1ll*(x[n]-x[i])*inv[n-i])%P)%P;}
	int tmp=0;
	for (int i=2;i<=n-1;i++) {
		tmp=(tmp+(1ll*inv[i]*inv[i-1])%P)%P;
		ans=(ans+(1ll*x[i]*tmp)%P)%P;
	}
	tmp=0;
	for (int i=n-2;i>=1;i--) {
		tmp=(tmp+(1ll*inv[n-1-i]*inv[n-1-i+1])%P)%P;
		ans=(ans-(1ll*x[i]*tmp)%P+P)%P;
	}
	for (int i=1;i<=n-1;i++) {ans=(1ll*ans*i)%P;}
	printf("%d\n",ans);
	return 0;
}