n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
mod=10**9+7
X=Y=0
for i in range(1,n):
    X+=(n-i)*i*(x[i]-x[i-1])
    X%=mod
for i in range(1,m):
    Y+=(m-i)*i*(y[i]-y[i-1])
    Y%=mod
print(X*Y%mod)