#include <bits/stdc++.h>
int main() {
  long long int x[100010], y[100010], i, j, a, b, c, d, e, n, m;
  e = 1000000007;
  scanf("%lld %lld", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &x[i]);
  }
  for (i = 1; i <= m; i++) {
    scanf("%lld", &y[i]);
  }
  d = 0;
  for (i = 1; i <= n - 1; i++) {
    for (j = 1; j <= m - 1; j++) {
      a = i * (n - i) % e;
      b = j * (m - j) % e;
      c = a * b % e;
      c = c * (x[i + 1] - x[i]) % e;
      c = c * (y[j + 1] - y[j]) % e;
      d = d + c;
    }
  }
  printf("%lld\n", d);
  return 0;
}
