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)

# ax ≡ 1 (mod m)なるxを返す
def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m


MOD=10**9+7
n=int(input())
x=list(map(int,input().split()))

P=1
for i in range(1,n):
    P=(P*i)%MOD

s=0
ans=0
for i in range(1,n):
    l=x[i]-x[i-1]
    s=s+P*modinv(i,MOD)
    s%MOD
    ans+=l*s
    ans%=MOD

print(ans%MOD)
