# coding: utf-8
import re
import math
#import numpy as np
n = int(input())
X = list(map(int, input().split()))
C=[1 for a in range(n-1)]
mod = 10 ** 9 + 7
fac = math.factorial(n - 1) % mod

for i in range(1,n - 1):
    len=i+1#左にあるスライムの個数
    C[i]=C[i-1]+ pow(len, mod - 2,mod)
    C[i]%=mod

ans = 0
for i in range(n-1):
    ans+=C[i]*(X[i+1]-X[i])
    ans%=mod
ans*=fac
ans%=mod
print(ans)