p = 10**9+7
N = int(input())
X = list(map(int,input().split()))
prod = 1
for i in range(2,N):
    prod = (prod*i)%p
prod2 = 1
for i in range(3,N):
    prod2 = (prod2*i)%p
tot = sum(X)
a = ((N-2)*prod2)%p
a = (a*(tot-X[0]))%p
a = a+(prod*X[-1])%p 
b = ((tot-X[-1])*prod)%p
print((a-b)%p)