#include <bits/stdc++.h>
using namespace std;
vector<long long> calc_times(long long n) {
  vector<vector<long long> > xc(n, vector<long long>(n));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      long long a = min({i + 1, j + 1, n - i, n - j});
      xc[i][j] = a;
    }
  }
  vector<long long> ret;
  for (long long i = 0; i < n; i++) {
    ret.push_back(accumulate(xc[i].begin(), xc[i].end(), 0));
  }
  return ret;
}
void solve(long long n, long long m, vector<long long> X, vector<long long> Y) {
  vector<long long> times_of_x(n - 1);
  vector<long long> times_of_y(m - 1);
  times_of_x = calc_times(n - 1);
  times_of_y = calc_times(m - 1);
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  long long answer = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = 0; j < m - 1; j++) {
      answer += (X[i + 1] - X[i]) * (Y[j + 1] - Y[j]) * times_of_x[i] *
                times_of_y[j] % 1000000007LL;
    }
  }
  answer = answer % 1000000007LL;
  cout << answer << endl;
}
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> X(n);
  vector<long long> Y(m);
  for (long long i = 0; i < n; i++) {
    cin >> X[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> Y[i];
  }
  solve(n, m, X, Y);
  return 0;
}
