#1/i!でなく1/iだった
n = int(input())
x = list(map(int, input().split( )))
mod = 10**9+7
#rev_fact = []
rev = []
res = 1
for i in range(1,n):
     rev_i = pow(i,mod-2,mod)
     #res *= rev_i
     #res %= mod
     #rev_fact.append(res)
     rev.append(rev_i)

n_fact = 1

for i in range(1,n):
    n_fact*=i
    n_fact%=mod
#print(n_fact)
ans = 0
tmp = 0
for i in range(n-1):
    tmp += rev[i]
    ans += (x[i+1]-x[i])*tmp
    ans %= mod
ans*=n_fact
ans%=mod
print(ans)
