Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
from itertools import permutations
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

MOD = 1000000000 + 7

N, *X = map(int, read().split())
cnt = 1
for i in range(1, N):
    cnt *= i
ans = 0

"""
l = list(permutations(range(1, N)))
for per in l:
    ans += np.abs(np.diff(np.array(list(per) + [N]))).sum()
    ans %= MOD
    print(ans, per)
"""

for i in range(1, N):
    for j in range(1, i+1):
        ans += j * (cnt / i)

print(int(ans % MOD))



Fixed submission:
import sys
import numpy as np
from itertools import permutations
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

MOD = int(1e+9 + 7)


class Comb(object):
    def __init__(self, n, MOD=1e9+7):
        self.n = n
        self.MOD = MOD

        fac = [0] * self.n
        finv = [0] * self.n
        inv = [0] * self.n

        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1

        for i in range(2, n):
            fac[i] = fac[i-1] * i % MOD
            inv[i] = MOD - inv[(MOD % i)] * (MOD // i) % MOD
            finv[i] = finv[i-1] * inv[i] % MOD
        self.fac = fac
        self.finv = finv
        self.inv = inv

    def calv(self, k):
        if self.n < k:
            return 0

        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.MOD) % self.MOD


N, *X = map(int, read().split())
X = np.array(X)
X_diff = np.diff(X)

comb = Comb(N+5, MOD)

acc = 0
ans = 0
for i in range(1, N):
    acc += comb.fac[N-1] * comb.inv[i]
    acc %= MOD

    ans += acc * (X_diff[i-1])
    ans %= MOD


print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
from itertools import permutations
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

MOD = 1000000000 + 7

N, *X = map(int, read().split())
X = np.array(X)

cnt = 1
for i in range(1, N):
    cnt *= i

cnt %= MOD
ans = 0

l = list(permutations(range(1, N)))
for per in l:
    ans += np.abs(np.diff(np.array(list(per) + [N]))).sum()

ans /= len(l) 
ans *= cnt

print(int(ans % MOD))



Fixed submission:
import sys
import numpy as np
from itertools import permutations
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

MOD = int(1e+9 + 7)


class Comb(object):
    def __init__(self, n, MOD=1e9+7):
        self.n = n
        self.MOD = MOD

        fac = [0] * self.n
        finv = [0] * self.n
        inv = [0] * self.n

        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1

        for i in range(2, n):
            fac[i] = fac[i-1] * i % MOD
            inv[i] = MOD - inv[(MOD % i)] * (MOD // i) % MOD
            finv[i] = finv[i-1] * inv[i] % MOD
        self.fac = fac
        self.finv = finv
        self.inv = inv

    def calv(self, k):
        if self.n < k:
            return 0

        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.MOD) % self.MOD


N, *X = map(int, read().split())
X = np.array(X)
X_diff = np.diff(X)

comb = Comb(N+5, MOD)

acc = 0
ans = 0
for i in range(1, N):
    acc += comb.fac[N-1] * comb.inv[i]
    acc %= MOD

    ans += acc * (X_diff[i-1])
    ans %= MOD


print(ans % MOD)