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

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

    if (n > 2000) return 0;

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

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