#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 1e5 + 5, MOD = 1e9 + 7;
int a[N];

ll bp(ll a, ll p) {
    ll r = 1;
    while (p > 0) {
        if (p & 1)
            r = r * a % MOD;
        a = a * a % MOD;
        p >>= 1;
    }
    return r;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll ans = 0, x = 0;

    for (int i = 0; i + 1 < n; i++) {
        x = (x + bp(i + 1, MOD - 2)) % MOD;
        ans = (ans + x * (a[i + 1] - a[i])) % MOD;
    }

    for (int i = 1; i <= n - 1; i++) {
        ans = ans * i % MOD;
    }

    cout << ans;

    return 0;
}