import math
N = int(input())
x = list(map(int,input().split()))
ans = 0
tmp = 0

frac = 1
for i in range(N):
    frac *= N
    frac = frac % 1000000007
for i in range(N-1):
    ans += (x[N-1] - x[i])/(i+1)*frac
    if ans > 1000000007:
        ans = ans % 1000000007

print(ans)
