import sys
input = sys.stdin.readline

# 1~nまでの逆元(mod m) O(n)
def mod_inv_list(n:int, m:int):
    # inv_t[i]: iの法mの下での逆元
    inv_t = [0] + [1]
    for i in range(2,n):
        inv_t += [inv_t[m % i] * (m - m//i) % m]
    return inv_t

def main():
    N = int(input())
    x = [int(i) for i in input().split()]
    MOD = 10**9 + 7

    inv_acum = mod_inv_list(N,MOD)
    for i in range(1,N):
        inv_acum[i] = (inv_acum[i] + inv_acum[i-1]) % MOD

    ans = 0
    for i in range(1,N):
        ans += (x[i] - x[i-1]) * inv_acum[i]
        ans %= MOD

    for i in range(1,N):
        ans = (ans * i) % MOD

    print(ans)

if __name__ == "__main__":
    main()