n = int(input())
X = list(map(int,input().split()))

delta = [X[i+1] - X[i] for i in range(n-1)]
mod = 10**9 + 7

mother = 1
for i in range(1,n):
    mother *= i
    if mother > mod:mother %= mod

total = 0
ans = 0
for i in range(n-1):
    now = (total*pow(i+1,mod-2,mod) + 1)%mod
    ans += now*delta[i]%mod
    if ans > mod: ans %= mod
    total += now
print(ans*mother%mod)
