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