p=10**9+7

n,m=map(int,input().split())
x=list(map(int,input().split()))
w=[x[i+1]-x[i] for i in range(n-1)]
y=list(map(int,input().split()))
h=[y[k+1]-y[k] for k in range(m-1)]

ans=0

for i in range (n-1):
    for k in range(m-1):
        ans=(ans+w[i]*h[k]*(1+i)*(n-i-1)*(1+k)*(m-k-1))%p

print(ans)