#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;
const int MOD = 1e+7;

ll add(ll a, ll b){
	return (a + b) % MOD;   
}

ll mul(ll a, ll b){
	return (a * b) % MOD; 
}

ll fact(ll N){
	if(N <= 1) return 1;
  	else return mul(N, fact(N-1));
}

ll fact_i(ll N, ll i){
	if(i==N) return fact(N-1);
  	if(i==N-1) return mul(N,fact(N-2));
  	if(i==1) return fact(N);
  	else return mul(N,fact_i(N-1,i)); 
}
                          
void Main()
{
	int N;
  	cin >> N;
  	vector<int> x(N);
  	rep(i,N) cin >> x[i];
  	
	ll coef = fact(N-1);
    //cout << 0 << ": " << coef << endl;
  	ll temp = x[1]-x[0];
  	ll sum = mul(coef,temp);
  	rep3(k,1,N-2){
  		coef += fact_i(N-1,k+1);
      	//cout << k << ": " << coef << endl;
  		temp = x[k+1]-x[k];
  		sum = add(sum,mul(coef,temp));
    }
  	cout << sum << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}