import math
mod = 10 ** 9 + 7


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

ans = 0
cum_pattern = []
pattern = 0
base = math.factorial(n-1) % mod
for i in range(1, n):
    pattern += base // i
    pattern %= mod
    cum_pattern.append(pattern)


ans = 0
for i in range(n-1):
    dist = X[i+1] - X[i]
    ans += cum_pattern[i] * dist % mod
    ans %= mod

print(ans)
