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+1)]
T=list(itertools.accumulate(t))

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

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