x = []
y = []
raw_input()
x = map(int, raw_input().strip().split())
y = map(int, raw_input().strip().split())
s = 0
for i in range(0, len(x) - 1):
    for j in range(i, len(x)):
        for k in range(0, len(y) - 1):
            for l in range(k, len(y)):
                s += (x[j] - x[i]) * (y[l] - y[k])
print s % (10 ** 9 + 7)