import math
import itertools

n=int(input())
x = list(map(int, input().split()))
y = list(itertools.accumulate(x))
ans=0
mod=10**9+7
v=sum(x)-x[0]*n

for i in range(n-1):
    if i==0:
        ans+=(v)*math.factorial(n-1)//(n-1-i)
    else:
        v-=(n-i)*(x[i]-x[i-1])

        ans += (v) * math.factorial(n - 1) // (n - 1 - i)
        ans%=mod




print(ans)