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

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)
for i in range(N-1):
    if i == 0:
        cnt[i] = sm
        tmp = sm
    else:
        tmp = tmp * i // (i+1)
        cnt[i] = cnt[i-1] + tmp
# print(cnt)

ans = np.mod((dif * cnt), MOD)
# print(ans)
ans = ans.sum() % MOD
print(ans)
