#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

LL n,m,k;
LL fac[200005],inv[200005];
LL a[200005],b[200005];
LL ans = 0;

LL kpw(LL x,LL y){
	LL ans = 1,tmp = x % N;
	while(y){
		if(y & 1) ans = (ans * tmp) % N;
		tmp = (tmp * tmp) % N;
		y >>= 1;
	}
	return ans;
}

int main(){
	ios::sync_with_stdio(false);
	fac[0] = 1; for(LL i = 1;i <= 200000;i ++) fac[i] = (fac[i - 1] * i) % N;
	inv[0] = 0; for(LL i = 1;i <= 200000;i ++) inv[i] = (inv[i - 1] + kpw(i,N - 2)) % N;
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> b[i];
	n --;
	for(LL i = 1;i <= n;i ++) a[i] = (b[i + 1] - b[i]) % N;
	for(LL i = 1;i <= n;i ++){
		ans += (((inv[n - i + 1] * fac[n]) % N) * a[n - i + 1]) % N;
		ans %= N;
	}
	cout << ans << endl;
	return 0;
}