a = map(int,input().split(" "))
b = map(int,input().split(" "))
c = map(int,input().split(" "))

d = max(b)- min(b)
e = max(c)- min(c)

f = sum(range(a[0]))
g = sum(range(a[1]))

ans = (d * e * f * g) % (10**9 + 7)

print(ans)