import sys
read = sys.stdin.buffer.read

sys.setrecursionlimit(100002)
def myfact(n):
    if n < 2:
        return 1
    else:
        return n * myfact(n - 1)
n,*X=map(int,read().split())
mod = 10**9+7
last=X[-1]
X=[last-i for i in X[:-1]]

f=myfact(n-1)
flst=[f//i%mod for i in range(1,n)]
s = sum(i*j%mod for i,j in zip(X,flst))
print(s%mod)