import math
import itertools

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

factorial = math.factorial(N-1)
sumexp = 0

linelist = list(range(N-1))

patterns = [i for i in itertools.permutations(linelist, N-1)]
for pattern in patterns:
    expvalue = 0
    valexists = [True] * N
    for i in pattern:
        valcheck = i + 1
        expvalue += x[valcheck] - x[i]
        valexists[i] = False
        while valexists[valcheck] == False:
            valcheck += 1
            expvalue += x[valcheck] - x[valcheck - 1]
    sumexp += expvalue

answer = (sumexp * factorial // len(patterns)) % (10 ** 9 + 7)
print(answer)