#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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


MOD = 10 ** 9 + 7

def solve_fast(N, As):

    dists = []
    for i in range(N - 1):
        dists.append(As[i + 1] - As[i])
    # print("dists = ", dists)

    dist_sum = sum(dists)

    factorial = 1
    for n in range(N - 1): factorial *= (n + 1)

    ans = 0
    for n in range(2, N + 1):
        # print("fact {} * dist {} :".format(factorial, dist_sum))
        ans += factorial * dist_sum
        factorial *= (n - 1)
        factorial //= n
        dist_sum -= dists[n - 2]

    return ans % MOD

print(solve_fast(N, As))        
        



