//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

//library author : @drken
const int MAX = 510000;
const int MOD = 1000000007;

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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


// QT : https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
long long modinv(long long a, long long m = MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// main関数で使用する場合COMinit();で初期化する必要あり

int main(void){
    COMinit();

    int n;cin >> n;
    vector<mint> x(n);

    for (int i = 0; i < n; ++i)
    {
        // cin >> x[i];
        ll d;cin >> d;
        x[i] = (mint)d;
    }

    mint Tot = x[n-1] - x[0];// 全区間の和

    vector<mint> d(n-1);
    for (int i = 0; i < n-1; ++i)
    {
        d[i] = x[i+1] - x[i];
    }
    vector<mint> scr(n,0),scl(n,0);
    for(int i = 1;i <= n-1;i++){
        scr[i] = scr[i-1] + d[i-1];
        scl[i] = scl[i-1] + d[n-1-i]; //ここの計算は確認済み
    }
    vector<mint> cum_r(n,0),cum_l(n,0);
    for(int i = 1;i <= n-1;i++){
        cum_r[i] = cum_r[i-1] + scr[i];
        cum_l[i] = cum_l[i-1] + scl[i];
    }
    

    //二項係数の前計算をするCOMB(N-1,hogehoge)
    vector<mint> C(n);
    for (int i = 0; i <= n-1; ++i)
    {
        C[i] = (mint)COM(n-1,i);
    }

    //hoge!の前計算
    vector<mint> f(n+1,0);
    for (int i = 0; i < n+1; ++i)
    {
        if(i == 0)f[i] = (mint)1;
        else f[i] = f[i-1] * (mint)i;
    }
    mint ANS = 0;
    mint P = 0;
    for(int i = 1;i <= n-2;i++){
        // mint y = (Tot * (n-i+1) - (scr[n-i] + scl[n-i])) * C[i] * f[i-1] * f[n-i-1];
        // cout<<y.x << endl;

        P += (Tot * (n-i) - (cum_r[n-i-1] + cum_l[n-i-1] + scl[i])) * C[i+1] * f[i-1] * f[n-i-2];
//        if(i == 1)cout << P.x << endl;
    }
//    cout << P.x << endl;
    for(int i = 1;i <= n-1;i++){
        P += scl[i] * C[i] * f[i-1] * f[n-i-1];
//        cout << P.x << endl;
    }
//    mint ans = P*Q;
//    cout << ans.x << endl;
    cout << P.x << endl;
    return 0;
}

Measured memory_bytes: 18560