#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define p 1000000007
using namespace std;
long long n,m,a[10000001],f[10000001],inv[10000001],cnt,ans;

void line(int x){
	for(int i=2;i<=x;i++)ans*=i,ans%=p;
}

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(p-p/i)*inv[p%i]%p;
	}
	for(int i=1;i<n;i++){ 
		f[i]=((1*inv[i]%p*(1+f[i-1]))%p+((i-1)*inv[i]%p*f[i-1])%p)%p;
	}
	for(int i=2;i<=n;i++){
		ans=(ans+(f[i-1]*(a[i]-a[i-1])%p)%p)%p;
	}
	line(n-1);
	cout<<ans%p;
}