#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (ll i = (0), __last_i = (v.size()); i < __last_i; i++) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
  for (ll i = (0), __last_i = (v.size()); i < __last_i; i++) {
    if (i) os << endl;
    os << v[i];
  }
  return os;
}
const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
  ll n, m;
  vector<ll> vx, vy;
  ll sumx = 0;
  ll sumy = 0;
  cin >> n >> m;
  for (ll i = (0), __last_i = (n); i < __last_i; i++) {
    ll x;
    cin >> x;
    vx.push_back(x);
  }
  for (ll i = (0), __last_i = (m); i < __last_i; i++) {
    ll y;
    cin >> y;
    vy.push_back(y);
  }
  for (ll i = (0), __last_i = (n); i < __last_i; i++) {
    sumx += (i * vx[i]) % _MOD - ((n - i - 1) * vx[i]) % _MOD;
    sumx %= _MOD;
  }
  for (ll i = (0), __last_i = (m); i < __last_i; i++) {
    sumy += (i * vy[i]) % _MOD - ((m - i - 1) * vy[i]) % _MOD;
    sumy %= _MOD;
  }
  cout << (sumx * sumy) % _MOD << endl;
}
