import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[2,2,2,2],[1,1,1,1],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 

def main():
    n,m = inpm()
    x = inpl()
    y = inpl()
    N = [0 for _ in range(n-1)]
    M = [0 for _ in range(m-1)]
    cnt = n-1
    plus = 0
    for i in range(n-1):
        plus += cnt
        N[i] = plus
        N[-i-1] = plus
        cnt -= 2
        if cnt <= 0:
            break
    cnt = m-1
    plus = 0
    for i in range(m-1):
        plus += cnt
        M[i] = plus
        M[-i-1] = plus
        cnt -= 2
        if cnt <= 0:
            break
    ans = 0
    for i in range(n-1):
        for j in range(m-1):
            area = ((x[i+1]-x[i])*(y[j+1]-y[j])) % mod
            area = (area*N[i]) % mod
            area = (area*M[j]) % mod
            ans = (ans+area) % mod
    print(ans)   
    
if __name__ == "__main__":
    main()