N = int(input())
X = list(map(int, input().split()))
MOD = 10 ** 9 + 7

def prepare(n, MOD):
 
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

fact, rfact = prepare(N, MOD)

ret = 0
inv = 0
for i in range(N-1):
    diff = X[i+1] - X[i]
    inv += fact[i] * rfact[i+1]
    ret += diff * inv
    ret %= MOD

print(ret*fact[N-1]%MOD)

