n=int(eval(input()));a=list(map(int,input().split()));mod=10**9+7;x=m=1;z=0

for i in range(2,n):x=m=m*i%mod

for i in range(n):z=z+x*(a[i]-a[i-1])%mod;x=x+m*pow(i+1,mod-2,mod)%mod

print((z%mod))
N,*X=list(map(int,open(0).read().split()));M,g,q,r=10**9+7,1,[1,1],0

for i in range(1,N):r,g=(r+q[-1]*(X[-1]-X[i-1]))%M,g*i%M;q+=[M//(-~i)*-q[M%(-~i)]%M]

print((r*g%M))
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
x = m = 1
z = 0
for i in range(2, n):
    x = m = m * i % mod
for i in range(n):
    z = z + x * (a[i] - a[i - 1]) % mod
    x = x + m * pow(i + 1, mod - 2, mod) % mod
print((z % mod))

N, *X = list(map(int, open(0).read().split()))
M, g, q, r = 10**9 + 7, 1, [1, 1], 0
for i in range(1, N):
    r, g = (r + q[-1] * (X[-1] - X[i - 1])) % M, g * i % M
    q += [M // (-~i) * -q[M % (-~i)] % M]
print((r * g % M))

-n = int(eval(input())) -a = list(map(int, input().split())) -mod = 10**9 + 7 -x = m = 1 -z = 0 -for i in range(2, n): -    x = m = m * i % mod -for i in range(n): -    z = z + x * (a[i] - a[i - 1]) % mod -    x = x + m * pow(i + 1, mod - 2, mod) % mod -print((z % mod)) +N, *X = list(map(int, open(0).read().split())) +M, g, q, r = 10**9 + 7, 1, [1, 1], 0 +for i in range(1, N): +    r, g = (r + q[-1] * (X[-1] - X[i - 1])) % M, g * i % M +    q += [M // (-~i) * -q[M % (-~i)] % M] +print((r * g % M))