MOD = 10**9+7
n = int(input())
x = list(map(int, input().split()))
g = [0]
for i in range(n-1):
	g.append(x[i+1]-x[i])
ans = 0
coef = 0
for i in range(1, n):
	coef += pow(i, MOD-2, MOD)
	ans += coef * g[i]
	ans %= MOD
for i in range(1, n):
	ans *= i
	ans %= MOD
print(ans)