mod = 10**9 + 7
n = int(input())
lx = list(map(int, input().split()))

from math import factorial as kj

d = 0
ans = 0

for i in range(1, n):
  d += kj(n-1) // i % mod
  ans = (ans + (lx[i] - lx[i-1]) * d) % mod

print(ans)