import math

n = int(input())
x = list(map(int, input().split()))
ans = 0
mod = 10 ** 9 + 7
v = math.factorial(n - 1)
v %=mod

for i in range(1, n):
    ans += (x[n - 1] - x[i - 1]) * v // i
    ans %= mod

print(int(ans))