import math
import itertools

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

t=[]

for i in range(1,N+1):
    v=math.factorial(N-i)
    t.append(v)
T=itertools.accumulate(t)

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

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