import statistics
import math


def main():
    n = int(input())
    x = list(map(int, input().split()))

    c = 0
    t = 0
    for i in range(n-1):
        c += 1/(i+1)
        t += c * (x[i+1]-x[i])
        t %= 10**9+7

    print(int(t * math.factorial(n-1) % (10**9+7)))


main()
