N = int(input())
X = list(map(int, input().split()))

mod = 10**9+7

kukan_cnt = [0] * (N-1)

orig = 1
for i in range(1,N):
	orig *= i
	orig %= mod

kukan_cnt[0] = orig

tmp = 1

for i in range(1,N-1):
	tmp = pow(i+1,mod-2,mod)
	kukan_cnt[i] = kukan_cnt[i-1] + orig*tmp
	kukan_cnt[i] %= mod
	
ans = 0

for i in range(1,N):
	dist = X[i]-X[i-1]
	dist %= mod

	ans += dist*kukan_cnt[i-1]

	ans %= mod

print(ans)
