#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,s[100003],p,a[100003],jie[100003],ans;
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]);
		s[i]=s[i-1]+a[i],s[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=2;i<=n-1;i++)
	{
		p=aa(i-2,i-2)%mod*aa(n-1,n-1-i)%mod;
		ans=(ans+p*((s[n-1]-s[i-1]-(s[n-i]-s[0])+2*mod)%mod))%mod;
	}
	for(int i=n;i<=n;i++)
	{
		for(int j=1;j<=i-1;j++)
		{
			if(i==n)
				ans=(ans+(a[i]-a[j])%mod*aa(i-j-1,i-j-1)%mod*aa(n-1,n-(i-j+1)))%mod;
			else
				ans=(ans+(a[i]-a[j])%mod*aa(i-j-1,i-j-1)%mod*aa(n-1,n-1-(i-j+1)))%mod;
		}
	}
	cout<<ans;
	return 0;
}
