#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#include "library/debug.cpp"

struct combination {
    ll mod;
    vector<ll> fac, finv, inv;

    combination(int n, ll m) : fac(n), finv(n), inv(n) {
        mod = m;
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < n; 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;
        }
    }

    ll c(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;
    }

    ll p(int n, int k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * inv[k] % mod;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll n, mod = 1e9 + 7;
    cin >> n;
    vector<ll> x(n);
    rep(i, 0, n) cin >> x[i];
    vector<ll> d(n - 1);
    rep(i, 0, n - 1) d[i] = x[i + 1] - x[i];
    combination z(300000, mod);
    vector<ll> fc(n + 1);
    rep(i, 0, n - 1) {
        fc[i] = z.p(n - 1, i + 1);
        if (i) fc[i] = (fc[i] + fc[i - 1]) % mod;
    }
    ll ans = 0;
    rep(i, 0, n) {
        ans += d[i] * fc[i];
        ans %= mod;
    }
    cout << ans << endl;

    return 0;
}
