N = int(input())
X = list(map(int, input().split()))
ans = 0

fact = 1
for i in range(1, N):
    fact = fact * i

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

print(ans % (7 + (10**9)))