import math
import sys 
input = sys.stdin.readline
N = int(input())
x = list(map(int,input().split()))
mod = 10**9+7

d = [0]*(N-1)
"""
for i in range(N-1):
    d[i] = x[i+1]-x[i]
    d[i] %= mod
"""

kaijou = 1
for i in range(1,N):
    i %= mod
    kaijou *= i
    kaijou %= mod

ans=0
x=0
"""
def pow_r(x, n):
    """
    O(log n)
    """
    x %= mod
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)%mod
    else:  # standard case ② n is odd
        return (x * (pow_r(x ** 2, (n - 1) // 2)))%mod

for i in range(N-1):
    #(i+1)%(mod-2)を計算してyへ
    y = pow_r(i+1,mod-2)
    #x+= kaijou//(i+1))%(10**9+7)
    x += (kaijou*y)%mod
    ans+= (d[i]*x)%mod
"""
print(ans%mod)
