#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long minX = pow(10, 5);
  long maxX = pow(-10, 5);
  long minY = pow(10, 5);
  long maxY = pow(-10, 5);
  long long x, y;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x < minX) minX = x;
    if (x > maxX) maxX = x;
  }
  for (int i = 0; i < m; i++) {
    cin >> y;
    if (y < minY) minY = y;
    if (y > maxY) maxY = y;
  }
  long long ans = 0;
  x = maxX - minX;
  y = maxY - minY;
  long count = (n - 1) + (m - 1);
  long long wari = 7 + pow(10, 9);
  x %= wari;
  y %= wari;
  ans = (x * y) % wari;
  ans = (ans * count) % wari;
  cout << ans << endl;
  return 0;
}
