from decimal import *

n = int(input())
X = list(map(Decimal, input().split()))
mod = Decimal(10**9+7)

e = Decimal(1)
E = [Decimal(1)]
for i in range(2,n):
    e += + 1/Decimal(i)
    E.append(e)

Dif = []
for i in range(n-1):
    Dif.append(X[i+1]-X[i])

ans = 0
for i in range(n-1):
    ans += E[i] * Dif[i]
    ans = ans % mod

for i in range(1,n):
    ans = ans*i
    ans = ans % mod

ans = Decimal(ans).quantize(Decimal('1.'), rounding=ROUND_CEILING)

print(ans)