n =int(input())
x = list(map(int,input().split()))
MOD = 10**9+7
f =[0,1]  
g =[0,1] 
c = 0
ans = 0
for j in range(1,n+1):
    f.append((f[-1]*j)%MOD)
    g.append((g[-1]*(n-j))%MOD)

for i in range(1,n):
    c = (c*i + f[i])%MOD
    ans = (ans+c*(x[i]-x[i-1])*g[n-i])%MOD
print(ans)