import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def modinv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m #負の値を返さないように

def f(n,m):
    a = 1
    for i in range(2,n+1):
        a = a*i
    return a

N = int(input())
x = list(map(int,readline().split()))

ans = 0
P = 10**9+7

b = f(N-1,P)
#print(b)

for i in range(N-1):
    l = 0
    c = modinv(N-1-i,P)
    for j in range(i,N):
        l += x[j]-x[i]
        l %= P
    #print(l)
    l = l*b%P
    l = l*c%P
    ans += l

print(ans%P)
