    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) % md
    ans = 0
    fr = Frc(1, 1)
     
    for i in range(n-1):
        ans = (ans + fct * (slime[i+1] - slime[i]) * fr) % md
        fr += Frc(1, i + 2)
    print(ans)