import math

mod = 10**9 + 7

n = int(input())
x = list(map(int,input().split()))
dis = [x[i]-x[i-1] for i in range(1,n)]


f = math.factorial(n-1)
f %= mod

def modinv(a, mod=mod):
    return pow(a, mod-2, mod)
inv2 = modinv(2)

count = 0
for i in range(1,n):
    e = (i+1)*inv2%mod
    count = (count + e*dis[i-1])%mod
count = count*f%mod

print(int(count)%mod)
