# -*- coding: utf-8 -*-

"""
計算式は以下のように示される
C_n = (1/n)*(1+C_(n-1)) + ((n-1)/n)*C_(n-1)  =  C_(n-1)+(1/n)
"""

import math
N = int(input())
X = list(map(int, input().split()))

def calc(n):
    if n==1:
        return 1.0
    return calc(n-1)+(1.0/n)

ev = 0
for i in range(1,N):
    ev += (X[i]-X[i-1])*calc(i)
    if ev>=(10**9+7):
        ev = ev%(10**9+7)

print(int(ev*math.factorial(N-1)%(10**9+7)))