from fractions import Fraction
n=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(n):
    ans=(ans+(x[-1]-x[i])*(Fraction(1,i+1)))%(10**9+7)

for i in range(1,n):
    ans=ans*i%(10**9+7)
print(ans)
