#!/usr/bin/env python3
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
x = list(map(int,input().split()))
cum = [0]*n # 後ろからの累積わ sum(x[i:])
sum_x = sum(x)
cum[0] = sum_x
for i in range(1,n):
    cum[i] = cum[i-1] - x[i-1]
#print(n,x,cum)
e = 0
# x[0] ~ x[n-2]までのそれ以降の全点までの距離の平均を足し合わせる
for i in range(n-1):
    e += (cum[i] - (n-i)*x[i]) / (n-i-1)  
mod = 10**9+7
#print(e,math.factorial(n-1))
print(int(e * math.factorial(n-1))%mod)
