#include <bits/stdc++.h>
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  int x[n], y[m];
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%d", &y[i]);
  }
  int j, k, l, s;
  s = 0;
  for (j = 0; j < n; j++) {
    for (l = 0; l < m; l++) {
      for (i = 0; i < j; i++) {
        for (k = 0; k < l; k++) {
          s = s + (x[j] - x[i]) * (y[l] - y[k]);
        }
      }
    }
  }
  printf("%d\n", s);
  return 0;
}
