import numpy as np
n,m=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]

def kk(z):
  zk=[]
  zi=z[0]
  ns=0
  nl=len(z)
  
  for i in z:
    if zi!=i:
      zk.append(abs(i-zi) *(ns*(nl-ns))% (10**9 + 7))
    zi=i
    ns+=1
  return zk

nx=np.array(kk(x), dtype = 'int64').reshape(len(x)-1,1)
ny=np.array(kk(y), dtype = 'int64')
nxy=nx*ny
print((nxy.sum()) % (10**9 + 7))