from fractions import Fraction as Frc
import math

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

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