N = int(input())
x = list(map(int,input().split()))

inv_sum = [0]*(N+2)
inv_sum[0] = 1
for i in range(1,N):
    inv_sum[i] = inv_sum[i-1]+1/(i+1)

mod = int(1e9+7)
ans = 0

for i in range(N-1):
    ans += (x[i+1]-x[i])*inv_sum[i]
    
for i in range(1,N):
    ans = ans*(i%mod)

print(int(ans%mod))