import math

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