n = int(input())
xl = list(map(int,input().split()))

bl = []

for i in range(n-1):
    bl.append(xl[i+1] - xl[i])

import math
a = math.factorial(n-1)
c = a
ans = 0

for i in range(n-1):
    ans += c * bl[i]
    ans %= 10**9 + 7
    c += a // (i+2)

print(ans)