mod = 10**9+7
rng = 100100
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
n = int(input())
a = list(map(int,input().split()))
b = [a[i]-a[i-1] for i in range(1,n)]
lsini = [1,3]
ls = [fctr[n-1],fctr[n-1]*3*finv[2]%mod]
for i in range(2,n-1):
  x = lsini[-1]
  lsini.append(((i+1)*x+fctr[i])%mod)
  ls.append((lsini[-1]*fctr[n-1]*finv[i+1])%mod)
ans = 0
for i in range(n-1):
  ans = (ans + ls[i]*b[i])%mod
print(ans)