n = int(input())
x = list( map(int, input().split()))

ans = 0
MOD = 10**9 + 7

fact = 1
for i in range(1,n):
    fact *= i
    fact %= MOD

p = [0]*(n-1)
p[0] = 1 * fact

for i in range(1,n-1):
    p[i] = p[i-1] + fact/(i+1)
    p[i] %= MOD

for i in range(n-1):
    ans += (x[i+1]-x[i])*p[i]
    ans %= MOD

ans %= MOD

print(int(ans))