def modinv2(a,m):
    return pow(a,m-2,m)

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

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

ans = 0
P = 10**9+7

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

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

print(ans%P)
