#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod009 = 1000000009;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N, x[100000];
ll res;

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1)a = a*x%mod;
		x = x*x%mod;
		y /= 2;
	}
	return a;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	ll t = 0;
	for (int i = 1; i <= N - 1; i++) {
		t += modinv(i);
		t %= mod;
		res += t*(x[i] - x[i - 1]);
		res %= mod;
	}
	for (int i = 1; i <= N - 1; i++) {
		res *= i;
		res %= mod;
	}
	cout << res << endl;
}