mod = 10**9+7
n = int(input())
slime = [ int(v) for v in input().split() ]
distance = [ slime[i+1] - slime[i] for i in range(n-1) ]

ans = 0
t = 1
for i in range(1, n):
    t *= i
    t %= mod

s = 0
for i in range(n-1):
    s += t * pow(i+1, mod-2, mod)
    s %= mod
    ans += s * distance[i]
    ans %= mod

print(ans)
