n = int(input())
X = list(map(int, input().split()))
mod = 10**9 + 7
last=X[-1]
X=[last-i for i in X[:-1]]
l, left = 1, [1]
for i in range(1, n - 1):
    l *= i
    l %= mod
    left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
    r *= i
    r %= mod
    right.append(r)
right.reverse()
flst=[(i*j%mod)%mod for i,j in zip(left,right)]
s = sum(i*j%mod for i,j in zip(X,flst))
print(s%mod)