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