m,n=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
mod=10**9+7

if m>2 and n>2:
    X2=[(X[1]-X[0])%mod,(X[-2]-X[1])%mod,(X[-1]-X[-2])%mod]
    Y2=[(Y[1]-Y[0])%mod,(Y[-2]-Y[1])%mod,(Y[-1]-Y[-2])%mod]
    ans=0
    a,b1,b2,c=m*n,(2*m-2)*n,(2*n-2)*m,(2*m-2)*(2*n-2)
    ans+=(X2[0]*Y2[0] + X2[2]*Y2[0] + X2[0]*Y2[2] + X2[2]*Y2[2])*a%mod
    ans+=(X2[1]*Y2[0]+X2[1]*Y2[2])*b1%mod
    ans+=(X2[0]*Y2[1]+X2[2]*Y2[1])*b2%mod
    ans+=X2[1]*Y2[1]*c%mod
    print(ans%mod)
else:
    print(mod)