import math

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]=l[i]*(x[i+1]-x[i])%(10**9+7)

ans=sum(l)
ans=ans*math.factorial(n-1)%(10**9+7)
print(ans)
