MOD = 10**9+7
N = int(input())
x = list(map(int,input().split()))

kaijo = 1
for i in range(1,N):
    kaijo *= i
    kaijo %= MOD
"""for i in range(N-1):
    d[i] = x[i+1] - x[i]
    d[i] %= MOD
"""
prob = []
a = 0
for i in range(1,N):
    a += 1/i
    prob.append(a)
ans = 0
for i in range(1,N):

    """for j in range(1,i+1):
        prob += 1/j
    """
    ans += (x[i]-x[i-1]) * prob[i-1]
for i in range(1,N):
    ans *= i
    ans %= MOD 
ans = int(ans)
print(ans)