#include <bits/stdc++.h>
int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<long long> x(n), y(m);
  std::vector<unsigned long long> xsa(n - 1), ysa(m - 1);
  for (auto it = std::begin(x); it != std::end(x); it++) std::cin >> *it;
  for (auto it = std::begin(y); it != std::end(y); it++) std::cin >> *it;
  auto itx = std::begin(x);
  for (auto itxsa = std::begin(xsa); itxsa != std::end(xsa); itxsa++)
    *itxsa = *(++itx) - *itx;
  auto ity = std::begin(y);
  for (auto itysa = std::begin(ysa); itysa != std::end(ysa); itysa++)
    *itysa = *(++ity) - *ity;
  n--, m--;
  unsigned long long xsum = 0;
  for (int i = 0; i < n / 2 + n % 2; i++) {
    for (int j = i; j < n - i; j++) {
      xsum += xsa[j] * (n - i * 2) % 1000000007;
    }
  }
  unsigned long long ysum = 0;
  for (int i = 0; i < m / 2 + m % 2; i++) {
    for (int j = i; j < m - i; j++) {
      ysum += ysa[j] * (m - i * 2) % 1000000007;
    }
  }
  std::cout << xsum * ysum % 1000000007 << std::endl;
}
