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

x = [x for x in map(int, input().split())]

y = [y for y in map(int, input().split())]

sum_x = 0

sum_y = 0

ans = 0

for i in range(n):

    sum_x += (2*i - n + 1) * x[i] 

for j in range(m):

    sum_y += (2*j - m + 1) * y[j]

ans = sum_x * sum_y

print((ans%1000000007))
n, m = list(map(int, input().split()))

X = sorted([int(x) for x in input().split()])

Y = sorted([int(x) for x in input().split()])

mod = 1000000007



def diffSum(X): #Σ(X[j]-X[i]) 1<=i<j<=N

    l = len(X)

    Res = [(2*i-l+1)*X[i] for i in range(l)]

    return sum(Res)%mod



print((diffSum(X)*diffSum(Y)%mod))
n, m = list(map(int, input().split()))
x = [x for x in map(int, input().split())]
y = [y for y in map(int, input().split())]
sum_x = 0
sum_y = 0
ans = 0
for i in range(n):
    sum_x += (2 * i - n + 1) * x[i]
for j in range(m):
    sum_y += (2 * j - m + 1) * y[j]
ans = sum_x * sum_y
print((ans % 1000000007))

n, m = list(map(int, input().split()))
X = sorted([int(x) for x in input().split()])
Y = sorted([int(x) for x in input().split()])
mod = 1000000007


def diffSum(X):  # Σ(X[j]-X[i]) 1<=i<j<=N
    l = len(X)
    Res = [(2 * i - l + 1) * X[i] for i in range(l)]
    return sum(Res) % mod


print((diffSum(X) * diffSum(Y) % mod))

-x = [x for x in map(int, input().split())] -y = [y for y in map(int, input().split())] -sum_x = 0 -sum_y = 0 -ans = 0 -for i in range(n): -    sum_x += (2 * i - n + 1) * x[i] -for j in range(m): -    sum_y += (2 * j - m + 1) * y[j] -ans = sum_x * sum_y -print((ans % 1000000007)) +X = sorted([int(x) for x in input().split()]) +Y = sorted([int(x) for x in input().split()]) +mod = 1000000007 + + +def diffSum(X):  # Σ(X[j]-X[i]) 1<=i<j<=N +    l = len(X) +    Res = [(2 * i - l + 1) * X[i] for i in range(l)] +    return sum(Res) % mod + + +print((diffSum(X) * diffSum(Y) % mod))