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

modn = 1
modls = list()
for i in range(1,n):
    modn *= i
    modn %= mod
    modls.append(modn)

ans = 0

for j in range(n-1):
    for i in range(j+1,n-1):
        ans+=(x[i]-x[j])/((i-j)*(i-j+1))*modn
        ans%=mod
    ans+=(x[n-1]-x[j])/(n-1-j)*modn
    ans%=mod
print(int(ans))