# -*- coding: utf-8 -*-
# 整数の入力
n,m= map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))
yoko=0
tate=0
for i in range (0,len(x)-1):
  for j in range (i+1,len(x)):
    yoko+=x[j]-x[i]
for i in range (0,len(y)-1):
  for j in range (i+1,len(y)):
    tate+=y[j]-y[i]

print(yoko*tate)