import math

N = int(input())
x = list(map(int,input().split()))
  
ans = 0
mod = 10**9 + 7
fact = math.factorial(N-1)
n = 0
for i in range(N-1):
  n = n + (fact // (i+1))
  n = n % mod
  ans = ans + (x[i+1] - x[i]) * n
  ans = ans % mod

print(ans)