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