#include <bits/stdc++.h>
const int MOD = 1000000007;
int main() {
  int n, m, i, j;
  int b;
  int x, y, x1, y1, sum1 = 0, sum2 = 0, minx, maxx, maxy, miny;
  scanf("%d%d", &n, &m);
  scanf("%d", &b);
  maxx = minx = b;
  maxx %= MOD;
  minx %= MOD;
  for (i = 1; i < n; i++) {
    scanf("%d", &b);
    if (b > maxx) maxx = b;
    if (b < minx) minx = b;
    maxx %= MOD;
    minx %= MOD;
  }
  scanf("%d", &b);
  maxy = miny = b;
  maxy %= MOD;
  miny %= MOD;
  for (i = 1; i < m; i++) {
    scanf("%d", &b);
    if (b > maxy) maxy = b;
    if (b < miny) miny = b;
    maxy %= MOD;
    miny %= MOD;
  }
  int sumx, sumy, sum;
  sumx = (maxx - minx) % MOD;
  sumy = (maxy - miny) % MOD;
  sum = sumx * sumy;
  sum %= MOD;
  sum *= (n - 1) * (m - 1);
  sum %= MOD;
  printf("%d\n", sum);
  return 0;
}
