#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> x(n), y(m);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> y[i];
  }
  vector<ll> nx(n - 1), ny(m - 1);
  for (int i = 0; i < n - 1; ++i) {
    nx[i] = (n - 1 - i) * (i + 1) % MOD;
  }
  for (int i = 0; i < m - 1; ++i) {
    ny[i] = (m - 1 - i) * (i + 1) % MOD;
  }
  vector<ll> w(n - 1), h(m - 1);
  for (int i = 0; i < n - 1; ++i) {
    w[i] = (x[i + 1] - x[i]) % MOD;
  }
  for (int i = 0; i < m - 1; ++i) {
    h[i] = (y[i + 1] - y[i]) % MOD;
  }
  vector<vector<ll> > area(n - 1, vector<ll>(m - 1));
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < m - 1; ++j) {
      area[i][j] = w[i] * h[j] % MOD;
    }
  }
  ll ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < m - 1; ++j) {
      ans += area[i][j] * nx[i] * ny[j] % MOD;
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
