N = int(input())
a = list( map(int, input().split() ) )
result = float()
for i in range(N-1):
    result += (a[N-1] - a[i]) / ( i+1 )

for i in range(1,N):
    result *= i

if result.is_integer():
    result = int(result)
else:
    result = int(result)+1
    
print( result % (10**9+7) )