#include <bits/stdc++.h>
using ulli = unsigned long long int;
ulli calc_area(ulli x1, ulli y1, ulli x2, ulli y2) {
  ulli w = x2 - x1;
  ulli h = y2 - y1;
  return w * h;
}
int main(void) {
  using namespace std;
  int n, m;
  cin >> n >> m;
  vector<ulli> x;
  x.resize(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  vector<ulli> y;
  y.resize(m);
  for (int j = 0; j < m; ++j) cin >> y[j];
  ulli ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int k = i + 1; k < n; ++k) {
        for (int l = j + 1; l < m; ++l) {
          ans += calc_area(x[i], y[j], x[k], y[l]);
        }
      }
    }
  }
  ans %= 1000 * 1000 * 1000 + 7;
  cout << ans << endl;
  return 0;
}
