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

s = 0

for i in range(n-1):
    for j in range(i+1, n):
        for k in range(m-1):
            for l in range(k+1,m):
                tate = x[j] - x[i]
                yoko = y[l] - y[k]
                s += tate * yoko

s %= (10**9 + 7)

print(s)
