n, m = [int(x) for x in input().split(' ')]
hor = [int(x) for x in input().split(' ')]
ver = [int(x) for x in input().split(' ')]
area = 0
for i in range(n-1):
    for j in range(m-1):
        area += (i+1) * (((hor[i+1] - hor[i]) % (10 ** 9 + 7)) * ((ver[j+1] - ver[j]) % (10 ** 9 + 7))) % (10 ** 9 + 7) * (j+1) * (n-i-1) * (n-j-1)
        area = area % (10 ** 9 + 7)
print(area)