mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
fact = [i for i in range(n+1)]
fact[0] = 1
for i in range(n):
  fact[i+1] *= fact[i]
  fact[i+1] %= mod
tmp = [None] * n
tmp[0] = 0
for i in range(1,n):
	tmp[i] = (tmp[i-1] + fact[n-1] // i) % mod
for i in range(1,n):
  ans += (a[i]-a[i-1]) * tmp[i]
  ans %= mod
print(ans)
