#include <bits/stdc++.h>
using namespace std;
const uint64_t kP = 1000000007;
uint64_t mmul(uint64_t a, uint64_t b, uint64_t p) {
  return ((a % p) * (b % p)) % p;
}
uint64_t mpow(uint64_t a, uint64_t e, uint64_t p) {
  uint64_t ret = 1;
  uint64_t m = a % p;
  while (e) {
    if (e & 1) {
      ret = (ret * m) % p;
    }
    m = (m * m) % p;
    e >>= 1;
  }
  return ret;
}
uint64_t mdiv(uint64_t a, uint64_t b, uint64_t p) {
  return ((a % p) * mpow(b % p, p - 2, p)) % p;
}
const uint64_t MAX = 100000;
int main() {
  uint64_t n, m;
  cin >> n >> m;
  uint64_t x[MAX];
  uint64_t y[MAX];
  for (uint64_t i = 0; i < n; ++i) {
    cin >> x[i];
  }
  for (uint64_t i = 0; i < m; ++i) {
    cin >> y[i];
  }
  uint64_t ans = 0;
  for (uint64_t i = 0; i < n - 1; ++i) {
    for (uint64_t j = 0; j < m - 1; ++j) {
      uint64_t comb = mmul((i + 1) * (j + 1), (n - i - 1) * (m - j - 1), kP);
      uint64_t area =
          mmul(uint64_t(x[i + 1] - x[i]), uint64_t(y[j + 1] - y[j]), kP);
      ans = (ans + mmul(comb, area, kP)) % kP;
    }
  }
  cout << ans << endl;
  return 0;
}
