#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long x[100001], y[100001];
int main() {
  int n;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> y[i];
  }
  sort(x, x + n);
  sort(y, y + m);
  long long lw, ld;
  ld = (x[n - 1] - x[0]) % 1000000007;
  lw = (y[m - 1] - y[0]) % 1000000007;
  printf("%lld\n",
         (((ld * lw) % 1000000007) * (((n - 1) * (m - 1)) % 1000000007)) %
             1000000007);
  return 0;
}
