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

int main(){
	int i, num_slimes, num_factorial=1, MOD=pow(10,9)+7;
	int length_all=0, output;
	cin >> num_slimes;
	vector<int> pos_slimes(num_slimes), length_move(num_slimes-1);
	
	for(i=0;i<num_slimes;i++){
		cin >> pos_slimes.at(i);
	}
	for(i=0;i<num_slimes-1;i++){
		length_move.at(i) = pos_slimes.at(i+1)-pos_slimes.at(i);
		length_all += length_move.at(i);
	}
	
	// N-1階乗の計算
	for(i=1;i<num_slimes;i++){
		num_factorial = num_factorial*i % MOD;
	}

	// 距離の計算
	output = num_factorial*length_all;
	for(i=1;i<N-1;i++){
		
	}
	cout << output << endl;
	return 0;
}