import sys
input = sys.stdin.readline

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

    MOD = 10**9+7

    answer = 0
    for i in range(N-1):
        Psum = 0
        for j in range(i+1):
            Psum = (Psum + 1/(j+1)) % MOD
        answer = (answer + (x[i+1] - x[i]) * Psum) % MOD

    tmp = 1
    for i in range(1,N):
        tmp = (tmp * i) % MOD
    answer = (answer * tmp) % MOD
    print(int(answer))

if __name__ == "__main__":
    main()