from fractions import Fraction
n=int(input())
x=list(map(int,input().split()))
l=[1]
for i in range(1,n-1):
    l.append(l[-1]+Fraction(1,i+1))
#print(l)

for i in range(n-1):
    l[i]*=x[i+1]-x[i]

ans=sum(l)
for i in range(1,n):
    ans=ans*i%(10**9+7)
print(ans)