# 井井井 / ###
n,m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

mode = 10**9+7
xlist = [ [n-1-j for j in range(n-1-i) ] for i in range(n-1)]
ylist = [ [m-1-j for j in range(m-1-i) ] for i in range(m-1)]
s = 0
for i in range(n-1):
    for j in xlist[i] :
        for k in range(m-1):
            for l in ylist[k] :
                #print(i,j,k,l)
                s += ((x[j] - x[i])*(y[l]-y[k]))
print(s%mode)