n = int(input())
x = list(map(int, input().split()))
dis = []
for i in range(n-1):
    dis.append(x[i+1] - x[i])
kaijyo = 1
for i in range(1, n):
    kaijyo *= i
kaijyo_lis = []
for i in range(1, n):
    kaijyo_lis.append(kaijyo//i)
expect_sum = 0
for i in range(1, n):
    expect_sum += (dis[i-1] * sum(kaijyo_lis[0:i]))
print(expect_sum%(10**9+7))
