from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

import numpy as np

# In[]:
N = inp()
xx = inpl()

# N = 3
# xx = 1,2,3

# In[]:
aa = np.array([1], dtype=np.uint64)
fac = 1
for L in range(2,N):
    fac = fac*(L-1)%mod
    naa = np.array([fac]*L, dtype=np.uint64)
    naa[:L-1] += np.arange(L-1,0,-1, dtype=np.uint64) * aa
    naa[1:]   += np.arange(2,L+1, dtype=np.uint64) * aa
    naa %= mod
    aa = naa[:]
    # print(aa)

# print(aa)

# In[]:
dx = np.array([xx[i]-xx[i-1] for i in range(1,N)],dtype=np.uint64)
# print(dx)

# In[]:
ans = sum(aa*dx)%mod
print(int(ans))
