mod = 10**9+7
N = int(input())
x = list(map(int, input().split()))
dp = [[0] for _ in range(N)]
dp[0] = 0
f = 1
fact = [1]*N
for i in range(1, N):
    dp[i] = dp[i-1]*i+f
    dp[i]%=mod
    f*=i
    f%=mod
fact[-1] = 1
for i in range(N-1)[::-1]:
    fact[i] = fact[i+1]*(i+1)
    fact[i]%=mod
ans = 0
for i in range(N-1):
    ans+=dp[i+1]*fact[i+1]*(x[i+1]-x[i])%mod
    ans%=mod
print(ans)





