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