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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

ll pow(ll a, ll n, ll m) {
	ll ret = 1LL;
	for (; n > 0LL; n >>= 1LL, a = a * a % m) {
		if (n % 2LL == 1LL) {
			ret = ret * a % m;
		}
	}
	return ret;
}

int main() {
    ll N;
    cin>>N;
    vector<ll> v(N);
    for(ll i = 0; i < N; i++) cin>>v[i];
    vector<ll> d(N-1);
    for(ll i = 0; i < N-1; i++) d[i]=v[i+1]-v[i];
    ll ans = 0LL;
    ll P = 1;
    for(ll i = 1;i < N; i++) P = (P*i)%mod;
  	ll Q = P;
    for(ll i = 0; i < N-1; i++){
        ans=(ans+(d[i]*P)%mod)%mod;
        P=(P+Q*pow(i+2LL,mod-2,mod))%mod;
    }
    cout<<ans<<endl;
}