#include <bits/stdc++.h>
uint64_t mul_mod(uint64_t a, uint64_t iter, uint64_t mod) {
  uint64_t tmp = 0;
  for (int i = 0; i < iter; i++) {
    tmp += a;
    tmp %= mod;
  }
  return tmp;
}
uint64_t hoge(uint64_t cnt) {
  uint64_t tmp = 0;
  int32_t pp;
  uint64_t pinc = 0;
  for (int i = 0; i < cnt; i++) {
    int32_t p;
    uint64_t w;
    uint64_t inc;
    scanf("%d", &p);
    if (i == 0) {
      pp = p;
      continue;
    }
    w = (uint64_t)(p - pp);
    inc = pinc + mul_mod(w, i, ((uint64_t)1000000007));
    inc %= ((uint64_t)1000000007);
    tmp += inc;
    tmp %= ((uint64_t)1000000007);
    pp = p;
    pinc = inc;
  }
  return (uint64_t)tmp;
}
int main(void) {
  uint64_t n, m;
  scanf("%lu %lu", &n, &m);
  printf("%lu\n", (hoge(n) * hoge(m)) % ((uint64_t)1000000007));
  return 0;
}
