import sys
#import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def factorial(x, mod=10**9+7):
    # x! 階乗 ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp

N = ir()
X = lr()
MOD = 10 ** 9 + 7
limit = factorial(N-1)
last = X[-1]
X = [last - x for x in X] #最後までの距離
answer = 0
for i in range(1, N):
    answer += (X[i-1] * limit // i)%MOD
    answer %= MOD

print(answer)

# 42

