#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  vector<int> x, y;
  scanf("%d%d", &m, &n);
  int temp;
  for (int i = 0; i < m; i++) {
    scanf("%d", &temp);
    x.push_back(temp);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &temp);
    y.push_back(temp);
  }
  int area = 0;
  for (int i = 0; i < m - 1; i++) {
    for (int j = 0; j < n - 1; j++) {
      int unitArea = (x[i + 1] - x[i]) * (y[j + 1] - y[j]) % 1000000009;
      int unitCount = (i + 1) * (m - i - 1) * (j + 1) * (n - j - 1);
      int totalArea = unitArea * unitCount % 1000000009;
      area = (area + totalArea) % 1000000009;
    }
  }
  printf("%d", area);
}
