#include <bits/stdc++.h>
using namespace std;
int main() {
  int mod = 1000000007;
  int n, m;
  cin >> n >> m;
  vector<long> x(n), y(m);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> x.at(i);
  }
  sort(x.begin(), x.end());
  for (int i = 0; i < (int)(m); ++i) {
    cin >> y.at(i);
  }
  sort(y.begin(), y.end());
  long ans = (x.at(n - 1) - x.at(0)) * (y.at(m - 1) - x.at(0)) % mod * (n - 1) *
             (m - 1) % mod;
  cout << ans << endl;
}
