#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int a[100005], b[100005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int j = 0; j < m; j++) scanf("%d", &b[j]);
  sort(a, a + n);
  sort(b, b + m);
  long long x, y, z;
  if (n > m) swap(n, m);
  if (n == m)
    z = (long long)(n - 1) * (m - 1);
  else
    z = (long long)n * (m - 2);
  x = ((long long)a[n - 1] - a[0]);
  y = ((long long)b[n - 1] - b[0]);
  if (x < 0) x = -x;
  if (y < 0) y = -y;
  long long sum = ((x % mod * y % mod) % mod * z) % mod;
  printf("%lld\n", sum);
}
