#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int x[100000];
  int y[100000];
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> y[i];
  }
  int lenW = n - 1;
  int lenH = m - 1;
  int w[99999];
  int h[99999];
  for (int i = 0; i < lenW; ++i) {
    w[i] = x[i + 1] - x[i];
  }
  for (int i = 0; i < lenH; ++i) {
    h[i] = y[i + 1] - y[i];
  }
  int totalW, totalH;
  for (int i = 0; i < lenW / 2 + lenW % 2; ++i) {
    totalW += (w[i] + w[lenW - i - 1]) * (lenW + i * (lenW - 2));
  }
  if (lenW % 2 == 1) {
    totalW -= w[lenW / 2];
  }
  for (int i = 0; i < lenH / 2 + lenH % 2; ++i) {
    totalH += (h[i] + h[lenH - i - 1]) * (lenH + i * (lenH - 2));
  }
  if (lenH % 2 == 1) {
    totalH -= h[lenH / 2];
  }
  cout << totalH * totalW << endl;
  return 0;
}
