import numpy as np
from math import factorial


def main():
    mod = 10**9 + 7

    N = int(input())
    slimes = np.array(list(map(int, input().split())))
    costs = slimes[1:] - slimes[:-1]

    base = np.array([i*2 + 1 for i in range(1, N-1)])

    w = factorial(N-1) // 6
    base *= w

    base = np.insert(base, 0, 0)
    base += factorial(N-1)
    base = base % mod

    costs = base * costs
    costs = costs % mod

    total = sum(costs)
    print(total % mod)

    # stacked = costs
    #     #
    # added = [0]*(N-1)
    # normal = dict()
    #
    # for i in range(1, N):
    #     normal[i] = set(range(1, i))
    # print("normal", normal)
    #
    # for comb in combinations:
    #     print(comb)
    #     for c in range(1, N-1):
    #         idx = comb.index(c)
    #         # 自分+1が後ろに居れば0
    #         if c+1 in comb[idx:]:
    #             print(c, "correct")
    #             continue
    #         s = set(comb[:idx]) - normal[c]
    #         print(c, s)
    #         for i in s:
    #             added[i-1] += 1
    #
    # print(added)


if __name__ == '__main__':
    main()
