N = int(input())
x = list(map(int, input().split()))
MOD = 10 ** 9 + 7
count = 0

import math
for i in range(N - 2):
    count += (x[N - 1] - x[i]) * math.factorial(N - 1) / math.factorial(N - 2 - i)
count += x[N - 1] - x[N - 2]

print(int(count % MOD))