#include <bits/stdc++.h>
using namespace std;
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}
template <class F, class T>
void convert(const F &f, T &t) {
  stringstream ss;
  ss << f;
  ss >> t;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<long long> x(n), y(m);
  for (int i = 0; i < int(n); ++i) cin >> x[i];
  for (int i = 0; i < int(m); ++i) cin >> y[i];
  long long sum = 0, sumy = 0, sumx = 0;
  for (int k = 0; k < x.size(); k++) {
    sumx += ((k)*x[k] - (x.size() - 1 - k) * x[k]) % 1000000009LL;
  }
  for (int k = 0; k < y.size(); k++) {
    sumy += ((k)*y[k] - (y.size() - 1 - k) * y[k]) % 1000000009LL;
  }
  cout << (sumx * sumy) % 1000000009LL << endl;
}
