#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define print(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

int power (int a, int b = mod - 2)
{
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	READ(n);
	READARR(x, n);
	int fac[2002];
	fac[0] = 1;
	FOR (i, 1, 2000) fac[i] = fac[i - 1] * i % mod;
	
	int dp[2002][2002] = {};
	FOR (i, 1, n)
	{
	    dp[i][1] = fac[i - 1];
	    FOR (j, 2, n) dp[i][j] = (dp[i - 1][j] * (i - 1) + dp[i - 1][j - 1]) % mod;
	}
	
	int sum = 0;
	FOR (i, 1, n - 1)
	{
	    int s = 0;
	    FOR (j, 1, i) s = (s + j*dp[i][j]) % mod;
	    s = s * (x[i + 1] - x[i]) % mod * power(fac[i]) % mod * fac[n - 1] % mod;
	    sum = (sum + s) % mod;
	}
	
	cout << sum;
}