N = int(input())
X = list(map(int, input().split()))
MOD = 10**9+7
S = 0
res = 0
F = 1
for i in range(1,N):
    S += pow(i,MOD-2,MOD)
    res += (X[i]-X[i-1])*S
    res%=MOD
    F*=i
    F%=MOD
print(res*F%MOD)

