#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  long long sum = 0;
  cin >> n >> m;
  vector<int> ax(n);
  vector<int> ay(m);
  vector<long long> xlen;
  vector<long long> ylen;
  for (int i = 0; i < n; i++) cin >> ax[i];
  for (int i = 0; i < m; i++) cin >> ay[i];
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) xlen.push_back(ax[j] - ax[i]);
  for (int i = 0; i < m - 1; i++)
    for (int j = i + 1; j < m; j++) ylen.push_back(ay[j] - ay[i]);
  cout << sum;
}
