mod=10**9+7

n=int(eval(input()))

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

acum=[0]

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

  tmp=acum[-1]+pow(i,mod-2,mod)*pow(i+1,mod-2,mod)

  tmp%=mod

  acum.append(tmp)

ans=0

for i in range(n-1):

  ans+=arr[i]*acum[i]

  ans%=mod

  ans-=arr[i]*acum[n-2-i]

  ans%=mod

  ans-=arr[i]*pow(n-1-i,mod-2,mod)

  ans%=mod

for i in range(1,n):

  ans+=arr[-1]*pow(i,mod-2,mod)

  ans%=mod

for i in range(1,n):

  ans*=i

  ans%=mod

print(ans)
mod=10**9+7

n=int(eval(input()))

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

acum=[1]

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

  tmp=acum[-1]+pow(i,mod-2,mod)

  tmp%=mod

  acum.append(tmp)

ans=0

for i in range(n-1):

  ans+=(arr[i+1]-arr[i])*acum[i]

  ans%=mod

for i in range(1,n):

  ans*=i

  ans%=mod

print(ans)
mod = 10**9 + 7
n = int(eval(input()))
arr = list(map(int, input().split()))
acum = [0]
for i in range(1, n + 1):
    tmp = acum[-1] + pow(i, mod - 2, mod) * pow(i + 1, mod - 2, mod)
    tmp %= mod
    acum.append(tmp)
ans = 0
for i in range(n - 1):
    ans += arr[i] * acum[i]
    ans %= mod
    ans -= arr[i] * acum[n - 2 - i]
    ans %= mod
    ans -= arr[i] * pow(n - 1 - i, mod - 2, mod)
    ans %= mod
for i in range(1, n):
    ans += arr[-1] * pow(i, mod - 2, mod)
    ans %= mod
for i in range(1, n):
    ans *= i
    ans %= mod
print(ans)

mod = 10**9 + 7
n = int(eval(input()))
arr = list(map(int, input().split()))
acum = [1]
for i in range(2, n + 1):
    tmp = acum[-1] + pow(i, mod - 2, mod)
    tmp %= mod
    acum.append(tmp)
ans = 0
for i in range(n - 1):
    ans += (arr[i + 1] - arr[i]) * acum[i]
    ans %= mod
for i in range(1, n):
    ans *= i
    ans %= mod
print(ans)

-acum = [0] -for i in range(1, n + 1): -    tmp = acum[-1] + pow(i, mod - 2, mod) * pow(i + 1, mod - 2, mod) +acum = [1] +for i in range(2, n + 1): +    tmp = acum[-1] + pow(i, mod - 2, mod) -    ans += arr[i] * acum[i] -    ans %= mod -    ans -= arr[i] * acum[n - 2 - i] -    ans %= mod -    ans -= arr[i] * pow(n - 1 - i, mod - 2, mod) -    ans %= mod -for i in range(1, n): -    ans += arr[-1] * pow(i, mod - 2, mod) +    ans += (arr[i + 1] - arr[i]) * acum[i]