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

i64 mod_pow(i64 x, i64 n, i64 MOD = 1e9 + 7){
    i64 res = 1;
    while(n > 0){
        if(n & 1) res = (res * x) % MOD ;
        x = (x * x) % MOD;
        n >>= 1;
    }
    return res;
}

i64 mod_inv(i64 x, i64 MOD = 1e9 + 7){
    return mod_pow(x, MOD - 2, MOD);
}

int main(){
    i64 N;
    cin >> N;
    vector<i64> X(N);
    for(int i = 0; i < N; i++) cin >> X[i];
    
    const i64 MOD = 1e9 + 7;
    i64 inv_s = 0;
    i64 ans = 0;
    for(int i = 0; i < N-1; i++){
        inv_s = (inv_s + mod_inv(i+1)) % MOD;
        ans = (ans + (X[i+1] - X[i]) * inv_s) % MOD;
    }
    for(int n = 1; n < N; n++) ans = (ans * n) % MOD;
    cout << ans << endl;
}