def ABC058D(n, m, x, y):
    s = 0
    for i1 in range(n-1):
        for i2 in range(i1+1, n):
            w = x[i2] - x[i1]
            for j1 in range(m-1):
                for j2 in range(j1+1, m):
                    h = y[j2] - y[j1]
                    s += w * h
    print(s % 1000000007)

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