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

kai = [1]
tmp = 1
for i in range(1, n+1):
    tmp *= i
    tmp %= mod
    kai.append(tmp)
    
ans = 0
for i in range(1, n):
    tmp = 0
    for j in range(1, n-i+1):
        a = x[i+j-1] - x[i-1]
        a *= kai[n-1]
        if j != n-i:
            a *= kai[j-1]
            a *= pow(kai[j+1], mod-2, mod)
        else:
            a *= pow(j, mod-2, mod)
            a %= mod
        ans += a
        ans %= mod
print(ans)