import math

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

  
ans = ans % mod
print(ans)