n = int(input())
st = list(map(int, input().split()))

MOD = 10 ** 9 + 7

dif = [j - i for i, j in zip(st, st[1:])]

d = 1
for i in range(1, n):
  d = (d * i) % MOD  

li = []
ho = 0
for i in range(1, n):
  ho += d // i
  li.append(ho)

ans = 0
for i, j in zip(dif, li):
  ans += (i * j) % MOD

print(ans % MOD)