n, m = map(int, raw_input().split())
X = map(int, raw_input().split())
Y = map(int, raw_input().split())

mdl = 1000000007

numx = n - 1
numy = m - 1

A = 0
incrx = numx
multx = 0
for ix in xrange(numx):
    multx += incrx
    multy = 0
    incry = numy
    for iy in xrange(numy):
        multy += incry
        ly = (Y[iy + 1] - Y[iy])
        lx = (X[ix + 1] - X[ix])
        A += (((lx * ly)%mdl) * multx * multy)%mdl
        incry -= 2
    incrx -= 2
print A % mdl
