from decimal import Decimal

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

d = [x[i+1] - x[i] for i in range(n-1)]

ans = 0
c = 0
a = 1
for i in range(n-1):
    c += Decimal("1")/Decimal(str((i+1)))
    ans += d[i] * c
    a *= i+1

print((ans * a) % (10**9 + 7))