#include <iostream>
using namespace std;

const int M = 1000000007;
long long modinv(int a, int m) {
    int x = m, y = a, p = 1, q = 0, r = 0, s = 1;
    while (y != 0) {
        int u = x / y;
        int x0 = y; y = x - y * u; x = x0;
        int r0 = p - r * u, s0 = q - s * u;
        p = r; r = r0; q = s; s = s0;
    }
    return q < 0 ? q + m : q;
}

int main() {
    int n; cin >> n;
    int x[n]; for (int i = 0; i < n; i++) cin >> x[i];
    long long f = 1, A = 0, ans = 0;
    for (int i = 1; i < n; i++) f = f * i % M;
    for (int i = 1; i < n; i++) {
        A += f * modinv(i, M) % M;
        ans += A * (x[i] - x[i-1]) % M;
    }
    cout << ans % M << endl;
}
