from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n = inp()
    x = inpl()
    ans = 0
    d = []
    for i in range(n-1):
        d.append(x[i+1]-x[i])
    f = 0
    y = 1
    for i in range(1,n):
        f += f*(i-1)+(y*i)//mod
        y = (y*i)%mod
    a = y
    for i in range(n-1):
        ans = (ans + d[i]*y)%mod
        alpha = a//(i+2)
        beta = a%(i+2)
        alpha1 = f//(i+2)
        beta1 = f%(i+2)
        alpha2 = mod//(i+2)
        beta2 = mod%(i+2)
        
        plus = (i*alpha1)%mod
        plus = (plus*alpha2)%mod
        plus = (plus + alpha)%mod
        plus = (plus + alpha2*beta1)%mod
        plus = (plus + alpha1*beta2)%mod
        plus = (plus + (beta1*beta2+beta)//n)%mod
        y = (y+plus)%mod
    print(ans)

if __name__ == "__main__":
    main()