from math import factorial

N = int(input())
X = list(map(int, input().split()))
X_dis = [ X[-1]-X[i] for i in range(N-1) ]
mod = 10**9 + 7
fact = factorial(N-1)
ans = 0


for i in range(N-1):
    ans = ans + X_dis[i] * (fact // (i+1))

print(ans % mod)