import math

N = int(input())
xn = list(map(int, input().split()))
mod = 10**9+7

c = [1]
for i in range(1, N-1):
    c.append(c[i-1]+1/(i+1))


ans = 0
for i in range(N-1):
    ans += c[i]*(xn[i+1]-xn[i])

print(int(ans*math.factorial(N-1) % mod))