#include <bits/stdc++.h>
int main(void) {
  int n, m, i, j, x1, x2, y1, y2;
  long ans = 0, hx[100000], hy[100000];
  scanf("%d%d%d", &n, &m, &x1);
  for (i = 0; i < n - 1; i++) {
    scanf("%d", &x2);
    hx[i] = x2 - x1;
    x1 = x2;
  }
  scanf("%d", &y1);
  for (i = 0; i < m - 1; i++) {
    scanf("%d", &y2);
    hy[i] = y2 - y1;
    y1 = y2;
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m - 1; j++) {
      ans = (ans +
             hx[i] * hy[j] * (i + 1) * (n - i - 1) * (j + 1) * (m - j - 1)) %
            1000000007;
    }
  }
  printf("%ld\n", ans);
  return 0;
}
