n = int(input())
x = tuple(map(int,input().split()))

mod = 10**9 + 7
mul_l = [1] * (n+1)
mul_r = [1] * (n+1)
for i in range(1,n+1):
    mul_l[i] = mul_l[i-1] * i % mod

for i in range(n-1,-1, -1):
    mul_r[i] = mul_r[i+1] * i % mod

ans = 0
right = x[-1]
for i in range(n-1):
    tmp = right - x[i]
    tmp = tmp * mul_l[i] * mul_r[i+2] % mod
    ans = (ans + tmp)% mod

print(ans)