#include <bits/stdc++.h>
using namespace std;
static const unsigned long long MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n);
  vector<long long> y(m);
  unsigned long long i;
  for (i = 0; i < n; i++) cin >> x[i];
  for (i = 0; i < m; i++) cin >> y[i];
  unsigned long long width =
      *max_element(x.begin(), x.end()) - *min_element(x.begin(), x.end());
  unsigned long long height =
      *max_element(y.begin(), y.end()) - *min_element(y.begin(), y.end());
  unsigned long long area = width * height;
  unsigned long long rectangles = (n - 1) * (m - 1);
  cout << (area * rectangles) % MOD << endl;
  return 0;
}
