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

sum = 0

for i in range(n-1):
    for j in range(n):
        for k in range(n):
            if j-k == i+1:
                for p in range(m-1):
                    for q in range(m):
                        for r in range(m):
                            if q-r == p+1:
                                sum += (x[j]-x[k])*(y[q]-y[r])
print sum % (10**9+7)