import math
import itertools

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

C=0
t=[math.factorial(N-i) for i in range(1,N)]
T=list(itertools.accumulate(t))

for j in range(1,N):
    C=C+(x[j]-x[j-1])*T[j-1]

print(C%((10 ** 9)+7))