# -*- coding: utf-8 -*-

n, m = input().split()
x = input().split()
y = input().split()
width = [abs(int(x[i])-int(x[j])) for i in range(len(x)-1) for j in range(i+1, len(x))]
height = [abs(int(y[i])-int(y[j])) for i in range(len(y)-1) for j in range(i+1, len(y))]

sum = 0
for w in width:
    for h in height:
        sum = sum + w * h
print(sum % (10 ** 9 + 7))
