n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
m=1
for i in range(2,n):m=m*i%mod
def m_b(b):return m*pow(b,mod-2,mod)%mod
ans=0
x=0
y=0
for i in range(n-1):
  x+=m-y
  x%=mod
  y+=m_b(n-i-1)
  y%=mod
  ans+=x*(a[i+1]-a[i])
  ans%=mod
print(ans)