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

mod = 10**9 + 7

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

n_s1 = [(n_pow*pow(i,mod-2,mod))%mod for i in range(1,N)]

n_s2 = [n_s1[0]]

s = n_s1[0]

for i in range(1,N-1):
    s+=n_s1[i]
    s%=mod
    n_s2.append(s)

ans = 0

for i in range(N-1):
    ans += (X[i+1]-X[i])*n_s2[i]
    ans %= mod

print(ans)

