n,m=list(map(int,input().split()))

x=[0]+list(map(int,input().split()))

y=[0]+list(map(int,input().split()))

mod=10**9+7

a1,a2=0,0

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

  a1+=(k*2-n-1)*x[k]

for k in range(1,m+1):

  a2+=(k*2-m-1)*y[k]

print(((a1*a2)%mod))
n,m=list(map(int,input().split()))

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

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

mod=10**9+7

x.sort()

y.sort()

sx,sy=0,0

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

  sx+=(2*k-n-1)*x[k-1]

  sx%=mod

for k in range(1,m+1):

  sy+=(2*k-m-1)*y[k-1]

  sy%=mod

print(((sx*sy)%mod))
n, m = list(map(int, input().split()))
x = [0] + list(map(int, input().split()))
y = [0] + list(map(int, input().split()))
mod = 10**9 + 7
a1, a2 = 0, 0
for k in range(1, n + 1):
    a1 += (k * 2 - n - 1) * x[k]
for k in range(1, m + 1):
    a2 += (k * 2 - m - 1) * y[k]
print(((a1 * a2) % mod))

n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9 + 7
x.sort()
y.sort()
sx, sy = 0, 0
for k in range(1, n + 1):
    sx += (2 * k - n - 1) * x[k - 1]
    sx %= mod
for k in range(1, m + 1):
    sy += (2 * k - m - 1) * y[k - 1]
    sy %= mod
print(((sx * sy) % mod))

-x = [0] + list(map(int, input().split())) -y = [0] + list(map(int, input().split())) +x = list(map(int, input().split())) +y = list(map(int, input().split())) -a1, a2 = 0, 0 +x.sort() +y.sort() +sx, sy = 0, 0 -    a1 += (k * 2 - n - 1) * x[k] +    sx += (2 * k - n - 1) * x[k - 1] +    sx %= mod -    a2 += (k * 2 - m - 1) * y[k] -print(((a1 * a2) % mod)) +    sy += (2 * k - m - 1) * y[k - 1] +    sy %= mod +print(((sx * sy) % mod))