import sys


def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    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


n = int(input())
xxx = list(map(int, input().split()))
MOD = 10 ** 9 + 7
factorials, invs = prepare(n, MOD)

# print(factorials)
# print(invs)

ans = 0
dp = [0]
for i in range(n - 1):
    y = xxx[i + 1] - xxx[i]
    tmp = 0
    for k in range(i + 1):
        # print(' ', k, (dp[k] + factorials[k]) * invs[k])
        tmp = (tmp + (dp[k] + factorials[k]) * invs[k]) % MOD
    tmp = tmp * factorials[i] % MOD
    dp.append(tmp)
    # print(dp)
    ans = (ans + y * tmp * invs[i + 1]) % MOD
    # print(i, y, tmp, tmp * invs[i + 1] * factorials[n - 1] % MOD)
ans = ans * factorials[n - 1] % MOD
print(ans)
