import sys
sys.setrecursionlimit(10**7)

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

def mod_factional(n):
    if n <= 1:
        return 1
    # return (n * mod_factional(n - 1)) % (10 ** 9 + 7)
    return n * mod_factional(n - 1)

ans = 0
p = mod_factional(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)
