from fractions import Fraction as Frc
import math

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]

    return (m+x%m)%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 * (slime[i + 1] - slime[i]) % md * c % md * mod_inv(p,md) ) % md
    fr += Frc(1, i + 2)
print(ans)