#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
bool comp(pii lhs, pii rhs) {
  if (lhs.first != rhs.first) return lhs.first < rhs.first;
  if (lhs.second != rhs.second) return lhs.second < rhs.second;
  return lhs.second < rhs.second;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<pii> v;
  int x[n], y[m];
  for (int i = 0; i < n; ++i) cin >> x[i];
  for (int i = 0; i < m; ++i) cin >> y[i];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      v.push_back({x[i], y[j]});
    }
  }
  sort(v.begin(), v.end(), comp);
  long long ans = 0;
  for (int i = 0; i < v.size(); ++i) {
    for (int j = 0; j < i; ++j) {
      if (v[i].first <= v[j].first || v[i].second <= v[j].second) continue;
      ans += abs((long long)(v[i].first - v[j].first) *
                 (v[i].second - v[j].second));
      ans %= (long long)inf;
    }
  }
  cout << ans << endl;
}
