#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 3e5+10;
const int inf = 0x3f3f3f3f;
const ll MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
#define X first
#define Y second

ll a[maxN];
ll c[maxN];
ll w[maxN];
ll power(ll x,ll p)
{
	if(p == 0)
		return 1;
	ll t = power(x,p/2);
	t = t*t % MOD;
	if(p%2 == 1)
	{
		t = t*x%MOD;
	}
	return t;
}
int main() {
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	ll s = 1;
	for(int i=1;i<n;i++)
	{
		s = s*i%MOD;
	}
	for(int i=1;i<n;i++)
	{
		c[i] = a[i+1] - a[i];
	}
	w[1] = s;
	for(int i=2;i<=n-1;i++)
	{
		w[i] = w[i-1] + s*power(i,MOD-2)%MOD;
		w[i] %= MOD;
	}
	ll sum = 0;
	for(int i=1;i<n;i++)
	{
		sum += w[i] * c[i];
		sum %= MOD;
	}
	cout<<sum<<endl;
	return 0;
}