N = int(input())
x = list(map(int, input().split()))
MOD = 10 ** 9 + 7
count = 0

y = []
for i in range(N - 1):
    y.append(x[i + 1] - x[i])

def cmb(n, r):
	if n - r < r:
		r = n - r
	if r == 0:
		return 1
	if r == 1:
		return n
	
	num = [n - r + k + 1 for k in range(r)] #numerator(分子)
	den = [k + 1 for k in range(r)] #denominator(分母)
	
	for p in range(2, r + 1):
		pivot = den[p - 1]
		if pivot > 1:
			offset = (n - r) % p
			for k in range(p - 1, r, p):
				num[k - offset] /= pivot
				den[k] /= pivot
	
	result = 1
	for k in range(r):
		if num[k] > 1:
			result *= int(num[k])
	
	return result

for i in range(N - 1):
    count += y[i] * cmb(N - 1, i)
print(count % MOD)