#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long mod(long long x) { return x % MOD; }
void MAIN() {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n), y(m);
  for (auto &i : x) cin >> i;
  for (auto &i : y) cin >> i;
  sort((x).begin(), (x).end());
  sort((y).begin(), (y).end());
  long long s = 0;
  for (long long i = 1; i < n; i++)
    for (long long j = 1; j < m; j++) {
      long long w = x[i] - x[i - 1];
      long long h = y[j] - y[j - 1];
      s += mod(mod(w * h) * mod(i * (n - i)) * mod(j * (m - j)));
      s = mod(s);
    }
  cout << s << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long T = 1;
  while (T--) MAIN();
}
