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

N = 1e+9 + 7

tmp = 1
l = []
ln = []
for i in range(n-1):
    tmp *= (i+1)%N
    l.append(tmp)
for k in range(n-1):
    ln.append(int(tmp/(k+1))%N)

a = 0
b = 1

for i in range(n-1):
    b *= (i+1)%N
    a += ((ln[i]%N) * (x[-1]-x[i]))%N

b *= n
print(int(a%N))