import sys
from fractions import Fraction
from math import factorial

rl = sys.stdin.readline


def solve():
    N = int(rl())
    x = list(map(int, rl().split()))
    MOD = 10 ** 9 + 7
    
    acc = [Fraction(0)] * N
    for i in range(1, N):
        acc[i] = acc[i - 1] + Fraction(1, i)
    
    ans = 0
    for i in range(N - 1):
        ans = ans + (x[i + 1] - x[i]) * acc[i + 1] % MOD
    
    ans = int(ans * factorial(N - 1) % MOD)
    print(ans)


if __name__ == '__main__':
    solve()
