#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<long long> x(n);
  vector<long long> y(m);
  long long sum = 0;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  cout << 4 * (x[n - 1] - x[0]) * (y[n - 1] - y[0]) << flush;
  return 0;
}
