#include <bits/stdc++.h>
#include "utils/macros.hpp"
#include "modulus/mint.hpp"
#include "modulus/factorial.hpp"
#include "modulus/choose.hpp"
using namespace std;
template <typename T> istream & operator >> (istream & in, vector<T> & xs) { REP (i, xs.size()) { in >> xs[i]; } return in; }

constexpr int MOD = 1e9 + 7;
mint<MOD> solve(int n, const vector<int> & x) {
    mint<MOD> ans = 0;
/*
    // O(n^2)
    REP (r, n) REP (l, r) {  // [l, r]
        int a = r - l - 1;
        int b = n - r + l - 1;
        ans += choose<MOD>(n - 1, a + 1 + (r != n - 1)) * fact<MOD>(a) * fact<MOD>(b - (r != n - 1)) * (x[r] - x[l]);
    }
*/
/*
    REP (r, n - 1) REP (l, r) {  // [l, r]
        ans += choose<MOD>(n - 1, r - l + 1) * fact<MOD>(r - l - 1) * fact<MOD>(n - r + l - 2) * x[r];
        ans -= choose<MOD>(n - 1, r - l + 1) * fact<MOD>(r - l - 1) * fact<MOD>(n - r + l - 2) * x[l];
    }
    int r = n - 1;
    REP (l, r) {  // [l, r]
        int a = r - l - 1;
        int b = n - r + l - 1;
        ans += choose<MOD>(n - 1, a + 1) * fact<MOD>(a) * fact<MOD>(b) * (x[r] - x[l]);
    }
*/
    vector<mint<MOD> > k(n - 1);
    REP3 (len, 1, n - 1) {
        k[len] = k[len - 1] + choose<MOD>(n - 1, len + 1) * fact<MOD>(len - 1) * fact<MOD>(n - len - 2);
    }
    REP (i, n - 1) {
        ans += k[i] * x[i];
        ans -= k[n - i - 2] * x[i];
    }
    int r = n - 1;
    REP (l, r) {  // [l, r]
        int a = r - l - 1;
        int b = n - r + l - 1;
        ans += choose<MOD>(n - 1, a + 1) * fact<MOD>(a) * fact<MOD>(b) * (x[r] - x[l]);
    }
    return ans;
}

int main() {
    int n; cin >> n;
    vector<int> x(n); cin >> x;
    cout << solve(n, x) << endl;
    return 0;
}
