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

t = input().split(" ")
x = []
for i in range(n):
    x.append(int(t[i]))
    
t = input().split(" ")
y = []
for i in range(m):
    y.append(int(t[i]))

print(x)
print(y)

r = 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):
                r += (x[j] - x[i]) * (y[l] - y[k])
print(r % (10 ** 9 + 7))