N = int(input())
X = list(map(int,input().split()))
import math
ans = 0
mod = 10**9+7
a = 0
ans = 0
for i in range(N-1):
  a += 1/(i+1)
  ans += (X[i+1]-X[i])*a

ans *= math.factorial(N-1)
print(int(ans)%mod)