#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000000 + 7;
int main() {
  ll n, m;
  vector<ll> x;
  vector<ll> y;
  cin >> n >> m;
  x.resize(n);
  y.resize(m);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> y[i];
  }
  ll ans = ((x[n - 1] - x[0]) * (y[m - 1] - y[0])) % mod;
  ans = ((n - 1) * ans) % mod;
  ans = ((m - 1) * ans) % mod;
  cout << ans << endl;
  return 0;
}
