#include <bits/stdc++.h>
long long power(long long base, long long exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base);
    base = (base * base);
    exp /= 2;
  }
  return res;
}
long long mod(long long a, long long b) { return (a % b + b) % b; }
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n), y(m);
  for (long long i = 0; i < n; i++) cin >> x[i];
  for (long long i = 0; i < m; i++) cin >> y[i];
  long long sumx = 0, sumy = 0;
  for (long long i = 0; i < n - 1; i++) {
    long long t = x[i + 1] - x[i];
    sumx += t * (i + 1) * (n - i - 1);
  }
  for (long long i = 0; i < m - 1; i++) {
    long long t = y[i + 1] - y[i];
    sumy += t * (i + 1) * (m - i - 1);
  }
  cout << sumx * sumy << '\n';
  return 0;
}
