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())

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

# In[]:
a = 1
for i in range(2,N):
    a *= i
    a %= mod

aa = [a]
for i in range(N-2):
    aa.append((aa[-1]+a//(i+2))%mod)

# print(aa)


# In[]:
dx = [xx[i]-xx[i-1] for i in range(1,N)]

# In[]:
ans = 0
for a,d in zip(aa,dx):
    ans += a*d

print(ans%mod)
