#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 1000000007
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll N;
	scanf("%lld", &N);
	ll x[N];
	
	for(ll i=0;i<N;i++){
		scanf("%lld", &x[i]);
	}
	ll kai[N];
	kai[0]=1;
	for(ll i=1;i<N;i++){
		kai[i]=kai[i-1]*i;
		kai[i]=kai[i] % SIZE;
	}
	
	ll answer=0;
	ll np=1;
	for(ll i=1;i<N;i++){
		answer=answer+kai[i-1]*(x[N-1]-x[i-1]);
		answer=answer % SIZE;
		if(i!=N-1)
		{answer=answer*(i+1);
		 answer=answer % SIZE;
		}
	
	}
	
	printf("%lld", answer);
}
