import math

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

fact = math.factorial(N - 1)
fact_list = []
tmp = 0

for i in range(1, N):
    tmp += fact / i
    fact_list.append(int(tmp))

ans = 0
mod = 1e9 + 7

for i in range(N - 1):
    ans += (X[i + 1] - X[i]) * (fact_list[i])
    ans %= mod

print(int(ans))
