# import sys
# sys.setrecursionlimit(10**7)
import math

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

# def factional(n):
#     if n <= 1:
#         return 1
#     return n * factional(n - 1)

ans = 0
# p = factional(N - 1)
p = math.factorial(N - 1)
m = p
for i, (x, y) in enumerate(zip(xs, xs[1:])):
    tmp = y - x
    ans += tmp * m
    ans %= 10 ** 9 + 7
    p = p // (i + 2) * (i + 1)
    m += p

print(ans)
