#include <bits/stdc++.h>
using std::abs;
using std::cin;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::priority_queue;
using std::queue;
using std::set;
using std::sort;
using std::string;
using std::to_string;
using std::vector;
const long long MOD = 1000000007;
int main(void) {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n);
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  vector<long long> y(m);
  for (long long i = 0; i < m; i++) {
    cin >> y[i];
  }
  long long sum = 0;
  for (long long s = 0; s < n - 1; s++) {
    for (long long t = 0; t < m - 1; t++) {
      const long long u = s + 1;
      const long long v = t + 1;
      long long area = (x[u] - x[s]) * (y[v] - y[t]) % MOD;
      area = area * (s + 1) % MOD;
      area = area * (t + 1) % MOD;
      area = area * (n - u) % MOD;
      area = area * (m - v) % MOD;
      sum = (sum + area) % MOD;
    }
  }
  cout << sum << endl;
  return 0;
}
