# 二項係数を"やるだけ"にしてくれるライブラリ

MAX = 510000

MOD = 1000000007

factrial = [0]*MAX

inverse = [0]*MAX

factrial_inverse = [0]*MAX





# テーブルを作る前処理

def COMinit():

    global factrial, inverse, factrial_inverse

    factrial[0] = 1

    factrial[1] = 1

    inverse[1] = 1

    factrial_inverse[0] = 1

    factrial_inverse[1] = 1

    for i in range(2, MAX):

        factrial[i] = factrial[i-1] * i % MOD

        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD

        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD





# 二項係数計算

def COM(n, k):

    global factrial, inverse, factrial_inverse

    if n < k:

        return 0

    if n < 0 or k < 0:

        return 0

    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD





# 前処理完了

COMinit()



N = int(eval(input()))

X = list(map(int, input().split()))

# expected_value = [1]

# for i in range(2, N):

#     expected_value.append(expected_value[-1]+(1/i))

ans = 0

f = factrial[N-1]

c = 0

for i in range(1, N):

    c += f * inverse[i]

    c %= MOD

    ans += c * (X[i] - X[i-1])

    ans %= MOD



print((ans % MOD))

# 二項係数を"やるだけ"にしてくれるライブラリ

MAX = 100005

MOD = 1000000007

factrial = [0]*MAX

inverse = [0]*MAX

factrial_inverse = [0]*MAX





# テーブルを作る前処理

def COMinit():

    global factrial, inverse, factrial_inverse

    factrial[0] = 1

    factrial[1] = 1

    inverse[1] = 1

    factrial_inverse[0] = 1

    factrial_inverse[1] = 1

    for i in range(2, MAX):

        factrial[i] = factrial[i-1] * i % MOD

        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD

        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD





# 二項係数計算

def COM(n, k):

    global factrial, inverse, factrial_inverse

    if n < k:

        return 0

    if n < 0 or k < 0:

        return 0

    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD





# 前処理完了

COMinit()



N = int(eval(input()))

X = list(map(int, input().split()))



ans = 0

prepro = [1]

for i in range(2, N+1):

    prepro.append((prepro[-1]+inverse[i]) % MOD)



for i in range(N-1):

    ans += (X[i+1]-X[i]) * prepro[i] % MOD



ans *= factrial[N-1]  # 期待値の総和に(N-1)!をかける



print((ans % MOD))

# 二項係数を"やるだけ"にしてくれるライブラリ
MAX = 510000
MOD = 1000000007
factrial = [0] * MAX
inverse = [0] * MAX
factrial_inverse = [0] * MAX
# テーブルを作る前処理
def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i - 1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD // i) % MOD
        factrial_inverse[i] = factrial_inverse[i - 1] * inverse[i] % MOD


# 二項係数計算
def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n - k] % MOD) % MOD


# 前処理完了
COMinit()
N = int(eval(input()))
X = list(map(int, input().split()))
# expected_value = [1]
# for i in range(2, N):
#     expected_value.append(expected_value[-1]+(1/i))
ans = 0
f = factrial[N - 1]
c = 0
for i in range(1, N):
    c += f * inverse[i]
    c %= MOD
    ans += c * (X[i] - X[i - 1])
    ans %= MOD
print((ans % MOD))

# 二項係数を"やるだけ"にしてくれるライブラリ
MAX = 100005
MOD = 1000000007
factrial = [0] * MAX
inverse = [0] * MAX
factrial_inverse = [0] * MAX
# テーブルを作る前処理
def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i - 1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD // i) % MOD
        factrial_inverse[i] = factrial_inverse[i - 1] * inverse[i] % MOD


# 二項係数計算
def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n - k] % MOD) % MOD


# 前処理完了
COMinit()
N = int(eval(input()))
X = list(map(int, input().split()))
ans = 0
prepro = [1]
for i in range(2, N + 1):
    prepro.append((prepro[-1] + inverse[i]) % MOD)
for i in range(N - 1):
    ans += (X[i + 1] - X[i]) * prepro[i] % MOD
ans *= factrial[N - 1]  # 期待値の総和に(N-1)!をかける
print((ans % MOD))

-MAX = 510000 +MAX = 100005 -# expected_value = [1] -# for i in range(2, N): -#     expected_value.append(expected_value[-1]+(1/i)) -f = factrial[N - 1] -c = 0 -for i in range(1, N): -    c += f * inverse[i] -    c %= MOD -    ans += c * (X[i] - X[i - 1]) -    ans %= MOD +prepro = [1] +for i in range(2, N + 1): +    prepro.append((prepro[-1] + inverse[i]) % MOD) +for i in range(N - 1): +    ans += (X[i + 1] - X[i]) * prepro[i] % MOD +ans *= factrial[N - 1]  # 期待値の総和に(N-1)!をかける