
from fractions import Fraction
n=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(1,n):
    p=0
    for j in range(1,i+1):
        p+=Fraction(1,j)
    ans+=(x[i]-x[i-1])*p
for k in range(1,n):
    ans=ans*k
ans=ans%(1000000000+7)
print(ans)