n=int(input())
x=list(map(int,input().split()))
c=0
m=10**9+7
q=[1,1]
p=[1,1]
an=0
for j in range(1,n+1):
    q.append((q[-1]*j)%m)
    p.append((p[-1]*(n-j))%m)
for i in range(1,n):
    c=(c*i+q[i])%m
    an=(an+(x[i]-x[i-1])*c*p[n-i])%m
print(an)