N = int(input())
X = list(map(int, input().split()))
d = [dj - di for di, dj in zip(X, X[1:])][::-1]

MOD = 10**9 + 7
count_d = [[0] * (N) for i in range(N-1)]
count_d[0][1] = 1

fac = 1
for n in range(1, N-1):
  fac = fac*n % MOD
  for i in range(1, n+2):
    count_d[n][i] = ((n+1-i+1)*count_d[n-1][i] + (i-1)*count_d[n-1][i-1] + fac)%MOD

ans = 0
for di, ci in zip(d, count_d[-1][1:]):
  ans += di*ci % MOD
  ans %= MOD

print(ans)