#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[100003],s=1,jie[100003],ans,sum[100003];
const int mod=1e9+7;
int poww(int x,int p)
{
	if(p==0)
		return 1;
	int tmp=poww(x,p/2)%mod;
	tmp=(tmp*tmp)%mod;
	if(p%2==1)
		tmp=(tmp*x)%mod;
	return tmp;
}
int aa(int n,int m)
{
	return jie[n]*poww(jie[n-m],mod-2)%mod;
}
signed main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<=n;++i)
		sum[i]=(sum[i-1]+a[i])%mod;
	jie[1]=1,jie[0]=1;
	for(int i=2;i<=100000;i++)
		jie[i]=jie[i-1]*i%mod;
	for(int i=1;i<=n-2;++i)
		ans=(ans+aa(i-1,i-1)*aa(n-1,n-1-(i+1))%mod*(sum[n-1]-sum[n-1-i]-sum[i])%mod)%mod;
	for(int i=1;i<n;++i)
		ans=(ans+aa(n-i-1,n-i-1)*aa(n-1,n-(n-i+1))%mod*(a[n]-a[i])%mod)%mod;
	cout<<ans;
	return 0;
}
