# -*- coding: utf-8 -*-

import os
import sys
import math
import numpy as np

n, m = map(int, input().split())
X = input().split()
X = list(map(int, X))
X = np.array(X)
Y = input().split()
Y = list(map(int, Y))
Y = np.array(Y)


# 1 つの最小長方形は (n-1)*(m-1) 回加算される

S = 0
mod = 10 ** 9 + 7

X_dif = X[1:]-X[:-1]
Y_dif = Y[1:]-Y[:-1]
Y_dif = Y_dif.reshape(m-1,1)
# print(X)
M = X_dif * Y_dif
M = M%mod

# print(M)

x_times = [(x+1) * (n-x-1) for x in range(n-1)]
x_times = np.array(x_times)
y_times = [(y+1) * (m-y-1) for y in range(m-1)]
y_times = np.array(y_times)

y_times = y_times.reshape(m-1,1)
# print(X)
MM = x_times * y_times
MM = MM%mod

# print(MM)

print(np.sum(M*MM)%mod)


# for x in range(n-1):
# 	for y in range(m-1):
# 		var = (X[x+1]-X[x]) * (Y[y+1]-Y[y])
# 		# print(var)
# 		x_times = (x+1) * (n-x-1)
# 		y_times = (y+1) * (m-y-1)

# 		S += ((var * x_times * y_times) % mod)


# # print(S%mod)