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

xd = int(x[-1]) - int(x[0])
yd = int(y[-1]) - int(y[0])
# print(xd * yd)
# print(len(x) - 1, len(y) - 1)
# print("-----")

# cx = 1
# cy = 1
calced = []
x = list(map(int, x))
y = list(map(int, y))
for cy in range(1, len(y)):
    for cx in range(1, len(x)):
        for targety in y[cy:]:
            for targetx in x[cx:]:
                # print(x[cx - 1], y[cy - 1], targetx, targety)
                calced.append((targetx - x[cx - 1]) * (targety - y[cy - 1]))
# print(calced)
print(sum(calced) % (10**9 + 7))
