import numpy as np
ans=0
n=int(input())
kai=1
war=10**9+7
for i in range(1,n):
  kai=kai*i
  kai=kai%war
s=list(map(int,input().split()))
s.reverse()
a=s[-1]
l=[i-a for i in s]
b=np.array(l)
for i in range(1,n):
  ans+=((np.sum(b)*kai)/(n-i))%war
  b=np.delete(b,-1)
  b-=(s[n-i-1]-s[n-i])
print(int(ans%war))