#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
constexpr int MOD = 1e9+7;
int n, x, p;
ll ac, m, ans;
ll inv(ll n){
	ll res = 1;
	for(ll m = MOD-2; m; m/=2,(n*=n)%=MOD) if(m%2) (res *= n) %= MOD;
	return res;
}
int main(){
	scanf("%d%d", &n, &p);
	rep(i,n-1){
		scanf("%d", &x);
		p = x - p;
		(m += inv((ll)i * (i+1) % MOD)) %= MOD;
		(ac += 1 - m + MOD) %= MOD;
		(ans += ac * p % MOD) %= MOD;
		p = x;
	}
	rep(i,n-1) (ans *= i+1) %= MOD;
	printf("%lld\n", ans);
}