import sys

sys.setrecursionlimit(100001)

import math

denom = int(1e9+7)


def calc_coeff(n):
    if n == 1:
        return [1]
    elif n == 2:
        return[2,3]
    else:
        s = calc_coeff(n-1)
        ans = []
        #when first one is selected first
        ans.append(math.factorial(n) % denom)
        #otherwise
        for k in range(1,n-1):
            t = k*s[k-1] + (n-k-1)*s[k] + math.factorial(n-1) + s[k-1]
            ans.append(t % denom)
        t = (n-1)*s[n-2] + math.factorial(n-1) + s[n-2]
        ans.append(t % denom)
        return ans
    
    

N = int(input())
pos = [int(i) for i in input().split()]
x = []

coeff = calc_coeff(N-1)

tot = 0
for i in range(N-1):
    x.append(pos[i+1]-pos[i])
    tot += (coeff[i] * (pos[i+1]-pos[i])) % denom

print(tot % denom)