#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 100010
const int mod=1e9+7;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,a[N],inv[N],ans,sum;
int main(){
	n=read();
	inv[1]=1;
	for(int i=2;i<=n;++i){
		inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;
	}
	for(int i=1;i<=n;++i){
		a[i]=read();
	}
	for(int i=1;i<=n;++i){
		ans=(ans+1LL*sum*(a[i]-a[i-1]))%mod;
		sum=(sum+inv[i])%mod;
	}
	for(int i=1;i<n;++i){
		ans=1LL*ans*i%mod;
	}
	printf("%d\n",ans);
	return 0;
}

