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):
    for j in range(n):
            if i>j:
                for p in range(m):
                    for q in range(m):
                            if p > q:
                                sum += (x[i]-x[j])*(y[p]-y[q])
print sum % (10**9+7)