mod=10**9+7
n, m=map(int,input().split())
x=tuple(map(int,input().split()))
y=tuple(map(int,input().split()))

lx=[]
for i in range(0, n-1):
    for j in range(i, n):
        lx.append(x[j]-x[i])
ly=[]
for i in range(0, m-1):
    for j in range(i, m):
        ly.append(y[j]-y[i])

ans=0
for i in lx:
    for j in ly:
        ans+=i*j
        ans%=mod
print(ans)