import numpy
n, m = map(int, input().split(' '))
line_x = list(map(int, input().split(' ')))
line_y = list(map(int, input().split(' ')))
masu_x = [n-1]
masu_y = [m-1]
for i in range(1, n-1):
    masu_x.append(masu_x[i-1] + n - 1 - 2 * i)
for i in range(1, m-1):
    masu_y.append(masu_y[i-1] + m - 1 - 2 * i)
masu_x = numpy.mat(masu_x)
masu_y = numpy.mat(masu_y)
masu_multi = numpy.dot(masu_y.T, masu_x)
masu_area = numpy.zeros(tuple(masu_multi.shape))
for i in range(n-1):
    for j in range(m-1):
        masu_area[j][i] = ((line_x[i+1] - line_x[i]) * (line_y[j+1] - line_y[j])) % 1000000007
print(int(numpy.sum(numpy.array(masu_multi) * numpy.flipud(masu_area) % 1000000007) % 1000000007))
