import numpy as np
from math import factorial
MOD = 10**9 + 7

n = int(input())
dist = np.diff(list(map(int, input().split())))

L = np.cumsum(np.array([1 / x for x in range(1, n)]))
n_1 = factorial(n-1)
# L *= n_1

# print(int((np.sum(L * dist) * n_1) % MOD))

ans = 0
for l, d in zip(L, dist):
    ans += l * d % MOD

ans = (ans * n_1 % MOD)
print(int(ans))