import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import functools
N = int(input())
x = [int(i) for i in input().split()]
mod = 10**9+7
start = 1
all_dis = 0
for i in range(N-1):
    far = x[i+1]-x[i]
    all_dis += far*start*math.factorial(N-1)//math.factorial(i+1)
    start = (start*(i+2)+math.factorial(i+1))%mod
    all_dis %= mod
print(all_dis)