import numpy as np
# import math
import sys
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def factorial(n, MOD):
    res = 1
    for i in range(n):
        res *= i+1
        res %= MOD
    return res

N = int(readline())
x = np.array(readline().split(), dtype=np.int64)
# print(N, x)

dif = x[1:] - x[:N-1]
# print(dif)

cnt = np.zeros(N-1, dtype=np.int64)
# sm = math.factorial(N-1)
sm = factorial(N-1, MOD)
for i in range(N-1):
    if i == 0:
        cnt[i] = sm
        tmp = sm
    else:
        # tmp = tmp * i // (i+1)
        tmp = sm // (i+1)
        cnt[i] = cnt[i-1] + tmp
# print(cnt)

sums = np.mod((dif * cnt), MOD)
# print(sms)
ans = 0
for i in range(N-1):
    ans += sums[i]
    ans %= MOD
print(ans)