# B
import math
n = int(input())
lst = list(map(int, input().split()))
mod = 10**9 + 7
sp = [lst[i+1] - lst[i] for i in range(n-1)]

ex = [1]
t = 1
for j in range(2, n):
    t += 1/j
    ex.append(t)
totalex = 0
for s, e in zip(sp, ex):
    totalex += (s*e)%mod
ans = (totalex*math.factorial(n-1)) % mod
print(int(ans))