#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

struct SegmentTree {
    int n;
    vector<ll> node;
    ll calc(ll a, ll b) {
        return (a + b) % MOD;
    }
    ll e = 0;
    SegmentTree(vector<ll> v) {
        int sz = v.size();
        n = 1;
        while (n < sz) {
            n *= 2;
        }
        node.resize(2 * n - 1, e);
        for (int i = 0; i < sz; i++) {
            node[i + n - 1] = v[i];
        }
        for (int i = n - 2; i >= 0; i--) {
            node[i] = calc(node[2 * i + 1], node[2 * i + 2]);
        }
    }
    void update(int x, ll val) {
        x = n + x - 1;
        node[x] = val;
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = calc(node[2 * x + 1], node[2 * x + 2]);
        }
    }
    ll query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return e;
        if (a <= l && r <= b) return node[k];
        ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return calc(vl, vr);
    }
    ll at(int x) {
        return node[n + x - 1];
    }
};

int main() {
    vector<ll> kaijou(100100, 1);
    for (ll i = 1; i < 100100; i++) {
        kaijou[i] = (kaijou[i - 1] * i) % MOD;
    }

    int n;
    cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];

    vector<ll> fd(100100);
    for (ll d = 0; d <= n; d++) {
        ll now = kaijou[n - 1];
        now *= modinv((d + 2) * (d + 1) % MOD, MOD);
        now %= MOD;
        fd[d] = now;
    }

    vector<ll> naka(n - 2), soto(n - 2);
    rep(i, n - 2) naka[i] = x[i + 1] - x[i];
    rep(i, n - 2) soto[i] = (x[i + 1] - x[i]) * (ll)min(i + 1, n - 2 - i) % MOD;

    SegmentTree sg(naka), sh(soto);

    ll ans=0;
    for (int d = 0; d <= n - 3; d++) {
        ll k = (ll)min(d, n - d - 3);
        ll now=sh.query(0, k);
        now+=sh.query(n-2-k,n-2);
        now%=MOD;
        now+=(sg.query(k,n-2-k)*(k+1))%MOD;
        now%=MOD;
        now*=fd[d];
        now%=MOD;
        ans+=now;
        ans%=MOD;
    }

    for (int i = 0; i < n - 1; i++) {
        int j = n - 1;
        int d = j - i - 1;
        ll add = kaijou[n - 1];
        add *= kaijou[d];
        add %= MOD;
        add *= modinv(kaijou[d + 1], MOD);
        add %= MOD;
        add *= (x[j] - x[i]);
        add %= MOD;

        ans += add;
        ans %= MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 9072