x, y = [int(i) for i in input().split()]
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]


s=0;
#xの左位置
for ix1 in range(x-1):
    #xの右位置
    for ix2 in range(ix1+1,x):
        wide = xl[ix2] - xl[ix1]
        #yの下位置
        for iy1 in range(y-1):
            #xの右位置
            for iy2 in range(iy1+1,y):
                height = yl[iy2] - yl[iy1]
                s += wide * height
                #print(str(wide)+' '+str(height)+' '+str(s)+';  '+str(yl[iy1])+' '++str(iy2))

ans = s % (10**9 + 7)
print(ans)
