n = int(input())
x = [int(i) for i in input().split()]
a = n*x[-1] - sum(x)
for i in range(2, n):
    a*=i
    if a>1000000007:
        a%=1000000007
for i in range(2, n):
    l = (x[-1] - x[i-1])*(i-1)
    for j in range(2, n):
        if j!=i:
            l*=j
            if l>1000000007:
                l%=1000000007
    a-=l
    a%=1000000007
print(int(a))