import math
N = int(input())
X = list(map(int, input().split()))
Y = [1]
# for i in range(N - 1):
#     Y.append(X[i + 1] - X[i])

Z = [1]
f = 1
count = 0
N_F = math.factorial(N - 1)
for i in range(1, N):
    try:
        Y.append(X[i + 1] - X[i])
    except:
        Z.append(Z[i - 1] * (i + 1) + math.factorial(i))
        count += Z[i - 1] * N_F // math.factorial(i) * Y[i - 1]
        continue
    Z.append(Z[i - 1] * (i + 1) + math.factorial(i))
    count += Z[i - 1] * N_F // math.factorial(i) * Y[i - 1]

print(count % (10 ** 9 + 7))