from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def exgcd(x,y):
    if y == 0:
        return (x,1,0)
    else:
        g,b,a = exgcd(y, x%y)
        return (g, a, b-(x//y)*a)

# return y s.t. x*y mod p == 1
def modinv(x,p):
    g,a,b = exgcd(x,p)  # ax+bp = g, g=1 if mutually prime
    return a%p

# #
n = inn()
x = inl()

modinva = [1]*n
fact = 1
for i in range(2,n):
    modinva[i] = modinv(i,R)
    fact = (fact*i)%R
ddprint(modinva)
ddprint(fact)

sm = 0
for i in range(n-1):
    e = (x[n-1]-x[i])*modinva[n-1-i]
    for j in range(i+1,n-1):
        e += (x[j]-x[i])*modinva[j-i]*modinva[j-i+1]
    sm = (sm+e)%R
print((fact*sm)%R)
