#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
using namespace std;

/* debug macros */
#ifdef WAFDAYO
#define DBG_PRINT(s, t, u) { std::cerr << s << " \e[2m=\e[m \e[1m" << t << "\e[m" << u; }
#else
#define DBG_PRINT(s, t, u) {}
#endif
#define dbg(x) DBG_PRINT(#x, x, std::endl)
#define dbgc(x) DBG_PRINT(#x, x, ", ")
#define idbg(x, i) DBG_PRINT(#x "[" << i << "]", x[i], std::endl)
#define idbgc(x, i) DBG_PRINT(#x "[" << i << "]", x[i], ", ")

/* IO utilities */
struct read_item { read_item() {}; template<class T> operator T() { T t; std::cin >> t; return t; } };

/* types and constants */
typedef long long i64;
const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;
const i64 mod = 1e9 + 7;

int main() {

	const int n = read_item();
	vector<int> xs(n);
	for(int i = 0; i < n; i++) {
		xs[i] = read_item();
	}

	vector<i64> fact(n);
	fact[0] = 1;
	fact[1] = 1;
	for(int i = 2; i <= n; i++) {
		fact[i] = fact[i - 1] * i % mod;
	}

	vector<i64> dp;

	dp.resize(n);
	dp[n - 1] = 0;
	for(int pos = n - 2; pos >= 0; pos--) {
		i64 a = 0;
		for(int j = pos + 1; j < n; j++) {
			a += fact[n - j] * (xs[j] - xs[pos]) % mod;
			a = a % mod;
		}
		dp[pos] = (dp[pos + 1] + a) % mod;
	}

	printF("%lld\n", dp[0]);

	return 0;
}

/* wafdayo~~~ */
