N = int(input())
x = [int(i) for i in input().split()]

MOD = 10**9+7

answer = 0
for i in range(N-1):
    Psum = 0
    for j in range(i+1):
        Psum += 1/(j+1)
    answer = (answer + (x[i+1] - x[i]) * Psum) % MOD

tmp = 1
for i in range(1,N):
    tmp = (tmp * i) % MOD
answer = (answer * tmp) % MOD
print(int(answer))