import math
n = int(input())
x = list(map(int, input().split()))
r = 10 ** 9 + 7
p = math.factorial(n - 1)
ans = 0
f = x[n - 1]
for i in range(n-1):
    ans += (f - x[i]) * p
    ans %= r
    p = p * (i + 1) // (i + 2)

print(ans)