import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappop, heappush
import math

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

F = math.factorial(N-1)
t = 0
f = 0

for i in range(N-1):
    f += F // (i+1)
    x = X[i+1] - X[i]
    t += x * f

print(t % (10 ** 9 + 7))
