n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
s=[[0]*(n-1) for _ in range(m-1)]
area=0
for i in range(m-1):
  for j in range(n-1):
    s=(y[i+1]-y[i])*(x[j+1]-x[j])
    area=(area+s*(i+1)*(m-i-1)*(j+1)*(n-j-1))%1000000007
print(area)