#include<bits/stdc++.h>
using namespace std;

const int MOD = 1e9 + 7;
int N , arr[100003];

int poww(long long a , int b){
	int times = 1;
	while(b){
		if(b & 1) times = times * a % MOD;
		a = a * a % MOD; b >>= 1;
	}
	return times;
}

int main(){
	cin >> N;
	for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	int sum = 1 , ans = 0;
	for(int i = 2 ; i <= N ; ++i){
		ans = (ans + 1ll * sum * (arr[i] - arr[i - 1])) % MOD;
		sum = (sum + poww(i , MOD - 2)) % MOD;
	}
	for(int i = 1 ; i < N ; ++i) ans = 1ll * ans * i % MOD;
	cout << ans;
	return 0;
}