import queue
import copy
import math

N = int(input())

# 空白区切りの数値をリスト化
xn = list(map(int, input().split()))

mod_value = 10**9 + 7


def distance_average(xn):
    return xn[-1] - xn[0]


total_distance = 0

q = queue.Queue()
q.put(xn)

while not q.empty():
    line = q.get()
    total_distance += distance_average(line)

    if len(line) == 1:
        break

    original_line = copy.deepcopy(line)
    editing_line = copy.deepcopy(line)
    for remove_index in range(0, len(line) - 1):
        editing_line.pop(remove_index)
        q.put(editing_line)
        editing_line = copy.deepcopy(original_line)


exp = (total_distance / math.factorial(N-1)) * math.factorial(N-1)

sho, amari = divmod(exp, mod_value)

print(int(amari))