N = int(input())
x = list(map(int,input().split()))

mod = 10**9+7
inv = [0,1]
for i in range(2,N):
  inv.append(inv[mod % i]*(mod - mod//i) % mod)

fac = 1
for i in range(1,N):
    fac *= i
    fac %= mod

ans = 0
cur = 0
for i in range(1,N):
    cur += fac*inv[i]
    cur %= mod
    ans += cur*(x[i]-x[i-1])
    ans %= mod
print(ans)