n,m = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

S = 0

for i in range(n):
    for j in range(i,n):
        for k in range(m):
            for l in range(k,m):
                s = (x[j]-x[i])*(y[l]-y[k])
                S += s

print(S)
