from itertools import accumulate
from math import factorial
import decimal
decimal.getcontext().prec=1000
n=int(input())
x=list(map(int,input().split()))
m=10**9+7
l=list(accumulate([decimal.Decimal(1)/decimal.Decimal(str(i))for i in range(1,10**5+1)]))
ans=0
for i in range(n-1):ans+=(x[i+1]-x[i])*l[i]
print((int(ans*factorial(n-1)))%m)