def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m

n = int(input())
slime = [int(x) for x in input().split()]

md = 10 ** 9 + 7
fct = math.factorial(n - 1) % md
ans = 0
fr = Frc(1, 1)
for i in range(n - 1):
    c = fr.numerator
    p = fr.denominator
    ans = (ans + fct * modinv(p, md) * c % md * (slime[i + 1] - slime[i]) % md) % md
    fr += Frc(1, i + 2)
print(ans)