nm = str(input()).split(' ')
xAry = str(input()).split(' ')
yAry = str(input()).split(' ')

result = 0

for ms in range(int(nm[1])-1):
    for me in range(ms+1,int(nm[1])):
        for ns in range(int(nm[0])-1):
            for ne in range(ns+1,int(nm[0])):
                #print('%s,%s,%s,%s'%(ms,me,ns,ne))
                result += (int(yAry[me])-int(yAry[ms]))*(int(xAry[ne])-int(xAry[ns]))

result %= 1000000007

print(result)