#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using R = double;
int main(void) {
  ll mod = 1000000007;
  int n;
  int m;
  cin >> n >> m;
  ll x[n];
  ll y[m];
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  sort(x, x + n);
  ll ax = x[0];
  ll bx = x[n - 1];
  sort(y, y + m);
  ll ay = y[0];
  ll by = y[m - 1];
  ll w = (bx - ax);
  ll h = (by - ay);
  ll area = w * h * (n - 1) * (m - 1) % mod;
  cout << area << endl;
}
