# -*- coding: utf-8 -*-

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

x = map(int, raw_input().split())
y = map(int, raw_input().split())

area = 0
for i in range(n):
    for j in range(i,n):
        for k in range(m):
            for l in range(k,m):
                area += (x[j]-x[i])*(y[l]-y[k])
                area = area%1000000007
print(area)