import math

dev = 10**9+7

def kai(n):
    if n == 1:
        return 1
    else:
        return (n * kai(n-1)) % dev




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))

