import sys
input = sys.stdin.readline
from fractions import Fraction

def main(): 
    N = int(input())
    x = [int(i) for i in input().split()]

    MOD = 10**9+7

    answer = 0
    frac = 0
    for i in range(N-1):
        frac += Fraction(1,i+1)
        dist = (x[i+1] - x[i]) % MOD
        answer = (answer + dist * frac) % MOD
    for i in range(1,N):
        answer = (answer * i) % MOD

    print(int(answer))

if __name__ == "__main__":
    main()