import numpy as np

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

ans = 0
MOD = 10**9 + 7

p = [1]*(n-1)
p = np.array(p)

for i in range(1,n-1):
    p *= i+1
    p[i] = p[i-1] + p[i]/(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))