def rren(): return list(map(int, input().split()))
n, m = rren()
x = rren()
y = rren()
ans = 0
for now_x in range(n-1):
    for now_y in range(m-1):
        S = (x[now_x+1]-x[now_x])*(y[now_y+1]-y[now_y])
        count = (now_x+1)*(n-now_x-1)*(now_y+1)*(m-now_y-1)
        ans += S*count

print(ans%1000000007)