import math

n = int(input())
x = list(map(int, input().split()))
ans = 0
pattern = math.factorial(n-1)
p=1
k=pattern
while p < n:
  ans += k * (x[p]-x[p-1])
  ans %= 1000000007
  p += 1
  k += pattern//(p)
print(ans)