#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main(int argc, char *argv[]) {
  int n, m;
  scanf("%d %d", &n, &m);
  long long x[n];
  long long y[m];
  for (int i = 0; i < n; ++i) {
    scanf("%I64d", &x[i]);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%I64d", &y[i]);
  }
  sort(x, x + n);
  sort(y, y + m);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = 0; k < m; ++k) {
        for (int l = k + 1; l < m; ++l) {
          if (x[i] != x[j] && y[k] != y[l])
            ans = (ans + abs(x[i] - x[j]) * abs(y[k] - y[l])) % MOD;
        }
      }
    }
  }
  printf("%I64d", ans);
  return 0;
}
