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

def inv_sum(j):
    tmp = 0
    for i in range(1,j+1):
        tmp += 1/i
    print(tmp)
    return tmp

mod = int(1e9+7)
ans = 0

for i in range(N-1):
    ans += (x[i+1]-x[i])*inv_sum(i+1)
    
for i in range(1,N):
    ans = (ans*i)

print(ans%mod)