n = int(input())
x = list(map(int, input().split()))
dist = [x[i+1]-x[i] for i in range(n-1)]
mod = 10 ** 9 + 7

fact = [1]*(n+1)
r = 1
for i in range(1, n+1):
  fact[i] = r = r * i % mod
now = fact[n-1]
ans = 0
for k,d in enumerate(dist):
  ans = (ans + now * d) % mod 
  now += (fact[n-1] * pow(k+2,mod-2,mod)) % mod
print(ans)
