import sys
input = sys.stdin.readline

def inv(x):
    return pow(x, MOD-2, MOD)

N = int(input())
x = list(map(int, input().split()))
ans = 0
MOD = 10**9+7

fact = [1]

for i in range(1, N+1):
    fact.append(fact[-1]*i%MOD)

inv_table = [-1]*(N+1)

for i in range(N+1):
    inv_table[i] = inv(i)

inv_acc = [0]

for inv_i in inv_table:
    inv_acc.append(inv_acc[-1]+inv_i)
    
for i in range(N-1):
    ans += (x[i+1]-x[i])*(inv_acc[i+2]-inv_acc[1])
    ans %= MOD

ans *= fact[N-1]
ans %= MOD

print(ans)