import math

dev = 10**9+7

def kai(N):
  a = 1
  for i in range(1,N+1):
    a = a*i % dev
  return a




N = int(input())
X = list(map(int,input().split()))

D = list()
for i in range(N-1):
  D.append((X[i+1]-X[i])%dev)


s = 0
now = 0
for i in range(N-1):
  now += kai(N-1)/(i+1)
#  now += math.factorial(N-1)/(i+1)%dev
  s += (D[i]*now) % dev

print(int(s%dev))

