n,m=map(int,input().split())
lists=list(map(int,input().split()))
sub=list(map(int,input().split()))
mod=10**9+7
J=0
s=0
if n>=3 and m>=3:
    J=n*m*(lists[-2]-lists[1])*(sub[-2]-sub[1])
if True:    
    s=0
    for i in range(n-1):
        s+=(m-1)*(lists[i+1]-lists[i])*(i+1)*(n-1-i)*(sub[-1]-sub[-2]+sub[1]-sub[0])
        s=s%mod
    for j in range(1,m-2):
        s+=(n-1)*(sub[j+1]-sub[j])*(j+1)*(m-1-j)*(lists[-1]-lists[-2]+lists[1]-lists[0])
        s=s%mod
print((s+J)%mod)