#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int x[100000],y[100000],z[100000];
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n)cin>>x[i];
	z[0]=1;
	f(i,n-1){
		z[i+1]=z[i]*(i+1)%mod;
		y[i+1]=(y[i]*(i+1)+z[i])%mod;
	}
	f(i,n-1){
		ans+=(x[i+1]-x[i])*(z[n-1]*mypow(z[i+1],mod-2,mod)%mod)%mod*y[i+1]%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
}
