#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 1e5 + 10, P = 1e9 + 7;

inline int mpow(int a, int b) {
    int ans = 1;
    for (; b; b >>= 1, a = (ll) a * a % P)
        if (b & 1) ans = (ll) ans * a % P;
    return ans;       
}

int x[N], f[N];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> x[i];
    f[1] = 1;
    for (int i = 2; i < n; ++i) {
        f[i] = (f[i - 1] + mpow(i, P - 2)) % P;
    }
    int ans = 0;
    for (int i = 1; i < n; ++i) {
        ans = (ans + (ll) (x[i + 1] - x[i]) * f[i] % P) % P;
    }
    for (int i = 1; i < n; ++i)
        ans = (ll) ans * i % P;
    cout << ans << '\n';
    return 0;
}