mod = 10**9+7
n = int(input())
x = [int(x) for x in input().split()]
x = x[::-1]

dp = [0 for _ in range(n)]
dp[1] = x[0]-x[1]

xx = [0]
for i in range(n):
    xx.append((xx[-1]+x[i]) % mod)

fact = [1]
for i in range(n+1):
    fact.append((fact[-1]*(i+1)) % mod)


def inv(a, mod):
    r = [1, 0, a]
    w = [0, 1, mod]
    while w[2] != 1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = w
        w = r_new
    x, y = w[0], w[1]    # a*x+y*mod = 1
    return (mod+x % mod) % mod


for i in range(2, n):
    dp[i] += i*dp[i-1] + (x[0]-x[i])*fact[i-1]
    dp[i] %= mod
    for k in range(1, i):
        s = inv((i-k+1)*(i-k), mod)
        dp[i] += (x[k]-x[i]) * fact[i] * s
        dp[i] %= mod

print(dp[n-1])
