# -*- coding: utf-8 -*-


n,m = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))
xx = (x[-1] - x[0]) % (pow(10,9)+7)
yy = (y[-1] - y[0]) % (pow(10,9)+7)
ans = ( xx * yy * (n+m-2)) % (pow(10,9)+7) 

print(ans)