import math
n = int(input())
*x, = map(int, input().split())

inf = 10**9+7

d = [0]*(n-1)
for i in range(n-1):
    d[i] = abs(x[i+1]-x[i])

p = 1/(n-1)
ev = 0
sd = sum(d)
for i in range(len(d)):
    m = sd + sum(d[i+1:])
    ev += p*m%inf


print(int(ev*math.factorial(n-1)%inf))
