#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#pragma optimize("TKACHENKO-GORYACHENKO")
#define psl pair <string, ll>
#define pls pair <ll, string>
#define x first
#define y second
#pragma GCC optimize("O3")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
 
typedef long long ll;
 
typedef long double ld;
 
using namespace std;
 
const ll maxn = 1e5 + 100;
const ll mod = 1e9 + 7;

ll n, m, k, t;

ll A[maxn];

ll F[maxn];

ll st2[maxn];

ll stupid() {
	ll q;
	vector <ll> sum(n);
	vector <ll> B;
	for (q = 0; q < n - 1; q++) {
		B.pb(q);
	}
	ll ans = 0;
	while (1) {
		ll q, w;
		for (q = 0; q < n - 1; q++) {
			ll mn = n - 1;
			for (w = q + 1; w < n - 1; w++) {
				if (B[w] > B[q]) {
					mn = min(mn, B[w]);
				}
			}
			sum[B[q]] += A[mn] - A[B[q]];
			ans += A[mn] - A[B[q]];
			// if (B[q] == 0)cout << A[B[q]] << " " << A[mn] << endl;
		}
		// for (q = 0; q < n - 1; q++) {
		// 	cout << B[q] << " ";
		// }
		// cout << endl;
		if (!next_permutation(B.begin(), B.end())) {
			break;
		}
	}
	// for (q = 0; q < n - 1; q++) {
	// 	cout << sum[q] << " ";
	// }
	// cout << endl;
	return ans;
}

ll step(ll a, ll x) {
	if (x == 0) {
		return 1;
	}
	if (x % 2 == 1) {
		return step(a, x - 1) * a % mod;
	}
	ll t = step(a, x / 2);
	return t * t % mod;
}

ll del(ll p, ll q) {
	return p * step(q, mod - 2) % mod;
}

ll C[maxn];
 
int main()
{
	ll q, w, e, a, b, c, d;
	pyshnapyshnakaa;
	cin >> n;
	ll sum = 0;
	st2[0] = 1;
	F[0] = 1;
	for (q = 1; q < maxn; q++) {
		F[q] = F[q - 1] * q % mod;
		st2[q] = st2[q - 1] * 2 % mod;
	}
	for (q = 0; q < n; q++) {
		cin >> A[q];
		if (q != n - 1) {
			sum += A[q];
			sum %= mod;
			// sum += del(A[q], st2[q + 1]);
			// sum %= mod;
		}
	}
	ll ans1 = (-((sum * F[n - 1]) % mod) + mod) % mod;
	// cout << "SANS " << ans1 << endl;
	for (q = 1; q < n - 1; q++) {
		ll c = del(F[n - 1], F[q + 1]) * F[q - 1] % mod;
		C[q] = c;
		sum -= A[q - 1];
		sum = (sum + mod) % mod;
		// cout << q << " " << C[q] << " " << sum << endl;
		ans1 += sum * c % mod;
		ans1 %= mod;
	}
	// cout << ans1 << endl;
	sum = 0;
	for (q = 1; q < n; q++) {
		// cout << q << " " << C[q] << endl;
		ans1 += ((F[n - 1] - sum + mod) % mod) * (A[n - 1]) % mod;
		ans1 %= mod;
		sum += C[q];
		sum %= mod;
	}
	cout << ans1 << endl;
	return 0;
	ll ans = 0;
	for (q = 0; q < n - 1; q++) {
		ll sum = 0;
		ll s = 0;
		for (w = q + 1; w < n - 1; w++) {
			ans += (A[w] - A[q]) * del(F[n - 1], F[w - q + 1]) % mod 
			* F[w - q - 1] % mod;
			// s += (A[w] - A[q]) * del(F[n - 1], F[w - q + 1]) % mod;
			// cout << q << " " << w << " " << del(F[n - 1], F[w - q + 1]) << endl;
			sum += del(F[n - 1], F[w - q + 1]) * F[w - q - 1] % mod;
			sum %= mod;
		}
		// cout << q << " " << F[n - 1] - sum << endl;
		ans += (A[n - 1] - A[q]) * ((F[n - 1] - sum + mod) % mod);
		// s += (A[n - 1] - A[q]) * ((F[n - 1] - sum + mod) % mod);
		// cout << s << " S" << endl;
		ans %= mod;
		// cout << endl;
	}
	cout << ans << endl;
	// cout << stupid() << endl;
	// cout << del(3, 8) << endl;
	return 0;
}


Measured memory_bytes: 3456