import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
x = LIST()
dist = [x[i+1]-x[i] for i in range(n-1)]
n -= 1

dp = [[0]*n for i in range(n)]
dp[1][0] = 1
dp[1][1] = 1
for i in range(2, n):
    dp[i][0] = dp[i-1][0] *i
    for j in range(i-1):
        dp[i][j+1] = dp[i-1][j+1] * (i+1)
    dp[i][i] = sum(dp[i-1][1:i]) + i*dp[i][0]

res = [0,] + dp[n-1][1:n]
ans = [res[i]+dp[n-1][0]*n for i in range(n)]
temp = sum([ans[i] * dist[i] for i in range(n)])%MOD

print(temp)