#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] + inv[i]) % MOD;
    }
}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    COMinit();
 
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    int ans = 0;
    for(int i=1;i<N;i++){
      ans += (A[i]-A[i-1]) * finv[i];
      ans %= MOD;
    }
    ans *= fac[N-1];
    ans %= MOD;
    cout << ans << endl;

}