#include <bits/stdc++.h>
int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<long> xs(n), ys(m);
  for (auto &&x : xs) std::cin >> x;
  for (auto &&y : ys) std::cin >> y;
  std::sort(xs.begin(), xs.end());
  std::sort(ys.begin(), ys.end());
  unsigned long s = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = 0; k < m - 1; ++k) {
        for (int l = k + 1; l < m; ++l) {
          s = (s + (xs[j] - xs[i]) * (ys[l] - ys[k])) % 1000000007;
        }
      }
    }
  }
  std::cout << s << std::endl;
  return 0;
}
