#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;
//負数の合同も考慮に入れるmod関数
constexpr inline long long imod(const long long a, const long long b)
{
	return (a >= 0) ? (a % b) : (a % b + b);
}

template<long long>class modint;

//modintが引数の繰り返し2乗法
template<long long MOD>
constexpr modint<MOD> m_pow(modint<MOD> x, long long n);

//modの整数クラス
template <long long MOD = 998244353>
class modint
{
public:
	constexpr modint operator+(const modint& other)const
	{
		return modint(a + other.a >= MOD ? a + other.a - MOD : a + other.a, true);
	}
	constexpr modint operator-(const modint& other)const
	{
		return modint(a - other.a < 0 ? a - other.a + MOD : a - other.a, true);
	}
	constexpr modint operator*(const modint& other)const
	{
		return modint(imod(a * other.a, MOD), true);
	}
	constexpr modint operator+=(const modint& other)
	{
		a = a + other.a >= MOD ? a + other.a - MOD : a + other.a;
		//return modint(a, true);
		return *this;
	}
	constexpr modint operator-=(const modint& other)
	{
		a = a - other.a < 0 ? a - other.a + MOD : a - other.a;
		//return modint(a, true);
		return *this;
	}
	constexpr modint operator*=(const modint& other)
	{
		a = imod(a * other.a, MOD);
		//return modint(a, true);
		return *this;
	}
	constexpr modint operator+()const
	{
		return *this;
	}
	constexpr modint operator-()const
	{
		return modint(MOD - a >= MOD ? -a : MOD - a, true);
	}
	constexpr modint& operator++()
	{
		*this += 1;
		return *this;
	}
	constexpr modint operator++(int)
	{
		auto tmp = *this;
		*this += 1;
		return tmp;
	}
	constexpr modint& operator--()
	{
		*this -= 1;
		return *this;
	}
	constexpr modint operator--(int)
	{
		auto tmp = *this;
		*this -= 1;
		return tmp;
	}
	constexpr modint operator~()const
	{
		return m_pow<MOD>(*this, phi - 1);
	}
	constexpr modint& operator=(const modint& other)
	{
		a = other.a;
		return *this;
	}
	constexpr operator long long()const
	{
		return a;
	}
	constexpr explicit operator int()const
	{
		return (int)a;
	}
	constexpr modint(long long a_) :a(imod(a_, mod)) {}
	constexpr modint() : a(0) {}
	static constexpr long long mod = MOD;
private:
	static constexpr long long e_phi() {
		//無効な値は無視
		static_assert(MOD >= 2, "MODの値は2以上にしてください");
		//オイラー関数Φ(mod)を計算する
		long long res = MOD, tmp = MOD;
		for (LL i = 2; i * i <= MOD; ++i)
		{
			if (MOD % i == 0)
			{
				res = res / i * (i - 1);
				for (; tmp % i == 0; tmp /= i);
			}
		}
		if (tmp != 1)res = res / tmp * (tmp - 1);
		return res;
	}
public:
	static constexpr long long phi = modint<MOD>::e_phi();
private:
	//static long long e_phi;
	long long a;
	constexpr modint(long long a_, bool) : a(a_) {}
};



//mintの累乗
//x^nを計算します
template<long long MOD>
constexpr modint<MOD> m_pow(modint<MOD> x, long long n)
{
	modint<MOD> res = 1;
	while (n > 0)
	{
		if (n & 1)res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}



#include<iostream>

//mint型のstreamへの入出力対応
template<long long MOD>
std::ostream& operator<<(std::ostream& os, modint<MOD> i)
{
	os << (long long)i;
	return os;
}

template<long long MOD>
std::istream& operator >> (std::istream& is, modint<MOD>& i)
{
	long long tmp;
	is >> tmp;
	i = tmp;
	return is;
}

//内部で使用する関数
//arrをFFTする
//arr.size() == (1 << logN)
//rootは(1 << logN)乗すると1になる数で、
//roots[i]はrootのi乗(roots.size() == 1 << logN)
template <typename G>
vector<G> FFTraw(vector<G>arr, int logN, const vector<G>& roots) {
	int N = 1 << logN;
	assert(arr.size() == N);
	vector<G>res[2];
	res[0].resize(N);
	res[1].resize(N);
	for (int i = 0; i < N; ++i) {
		int num = 0;
		for (int b = 0; b < logN; ++b) {
			num <<= 1;
			if (i & (1 << b))num++;
		}
		res[0][i] = (arr[num]);
	}
	//for (int i = 0; i < N; ++i)arr[i] = res[i];
	for (LL i = 0; i < logN; ++i) {
		for (int dex = 0; dex < N; ++dex) {
			int mot = dex ^ (1 << i);
			int lef = min(mot, dex);
			int rht = max(mot, dex);
			res[(i + 1) & 1][dex] = res[i & 1][lef] + res[i & 1][rht] * roots[((LL)dex << (logN - i - 1)) % N];
		}
		//for (int i = 0; i < N; ++i)arr[i] = res[i];
	}
	return res[logN & 1];
}

using mint = modint<1000000007>;

//配列AとBのconvolution
//畳み込み演算をする
vector<mint>fold(vector<mint>A, vector<mint>B) {
	//static_assert(mint::mod == 998244353LL, "MODと原始根を貼りなおしてください。");
	vector<mint>C(A.size() + B.size());
	int logN = 0;
	while (C.size() > (1 << logN))++logN;
	C.resize(1 << logN);
	A.resize(1 << logN);
	B.resize(1 << logN);
	vector<mint>dC(C.size());
	mint root = m_pow(mint(3), (mint::mod - 1) >> logN);
	vector<mint>zeta{};
	zeta.push_back(root);
	zeta.push_back(root);
	zeta.reserve(1 << logN);
	for (int i = 1; i < (1 << logN) - 1; ++i) {
		zeta.push_back(root * zeta.back());
	}
	zeta.front() = zeta.back() * root;
	auto dA = FFTraw<mint>(A, logN, zeta);
	auto dB = FFTraw<mint>(B, logN, zeta);
	for (int i = 0; i < C.size(); ++i) {
		dC[i ? C.size() - i : 0] = dA[i] * dB[i];
	}
	C = FFTraw<mint>(dC, logN, zeta);
	for (mint& elm : C)elm *= ~mint(1LL << logN);
	return C;
}
int N;

int main() {
	cin >> N;
	vector<LL>X;
	for (int i = 0; i < N; i++) {
		LL x;
		cin >> x;
		X.push_back(x);
	}
	mint ima = 0;
	mint ans = 0;
	mint kai = 1;
	for (int i = 1; i < N; i++) {
		mint dif = X[i] - X[i - 1];
		ima += mint(1) * ~mint(i);
		ans += ima * dif;
		kai *= i;
	}
	ans *= kai;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400