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

e = 1
E = [1]
for i in range(2,n):
    e += + 1/i
    E.append(e)

Dif = []
for i in range(n-1):
    Dif.append(X[i+1]-X[i])

ans = 0
for i in range(n-1):
    ans += E[i] * Dif[i]

ans = ans % (10**9+7)
for i in range(1,n):
    ans = ans*i
    ans = ans % (10**9+7)

print(int(ans))