n = int(eval(input()))

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

mod = 10**9 + 7

X = []

for i in range(n - 1):

    X.append(x[i + 1] - x[i])

l, left = 1, [1]

for i in range(1, n - 1):

    l *= i

    l %= mod

    left.append(l)

r, right = 1, [1]

for i in range(n - 1, 1, -1):

    r *= i

    r %= mod

    right.append(r)

right.reverse()

f, flst = 0, []



for i, j in zip(left, right):

    f += i * j % mod

    f %= mod

    flst.append(f)

s = 0

for i, j in zip(X, flst):

    s += i * j % mod

print((s % mod))

n = int(eval(input()))

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

mod = 10**9 + 7

last=X[-1]

X=[last-i for i in X[:-1]]

l, left = 1, [1]

for i in range(1, n - 1):

    l *= i

    l %= mod

    left.append(l)

r, right = 1, [1]

for i in range(n - 1, 1, -1):

    r *= i

    r %= mod

    right.append(r)

right.reverse()

flst=[(i*j%mod)%mod for i,j in zip(left,right)]

s = sum(i*j%mod for i,j in zip(X,flst))

print((s%mod))
n = int(eval(input()))
x = list(map(int, input().split()))
mod = 10**9 + 7
X = []
for i in range(n - 1):
    X.append(x[i + 1] - x[i])
l, left = 1, [1]
for i in range(1, n - 1):
    l *= i
    l %= mod
    left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
    r *= i
    r %= mod
    right.append(r)
right.reverse()
f, flst = 0, []
for i, j in zip(left, right):
    f += i * j % mod
    f %= mod
    flst.append(f)
s = 0
for i, j in zip(X, flst):
    s += i * j % mod
print((s % mod))

n = int(eval(input()))
X = list(map(int, input().split()))
mod = 10**9 + 7
last = X[-1]
X = [last - i for i in X[:-1]]
l, left = 1, [1]
for i in range(1, n - 1):
    l *= i
    l %= mod
    left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
    r *= i
    r %= mod
    right.append(r)
right.reverse()
flst = [(i * j % mod) % mod for i, j in zip(left, right)]
s = sum(i * j % mod for i, j in zip(X, flst))
print((s % mod))

-x = list(map(int, input().split())) +X = list(map(int, input().split())) -X = [] -for i in range(n - 1): -    X.append(x[i + 1] - x[i]) +last = X[-1] +X = [last - i for i in X[:-1]] -f, flst = 0, [] -for i, j in zip(left, right): -    f += i * j % mod -    f %= mod -    flst.append(f) -s = 0 -for i, j in zip(X, flst): -    s += i * j % mod +flst = [(i * j % mod) % mod for i, j in zip(left, right)] +s = sum(i * j % mod for i, j in zip(X, flst))