#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {
  int n, m, i, j, k, l;
  scanf("%d %d", &n , &m);


  long long *x;
  long long *y;
  x = malloc(sizeof(long long) * n);
  y = malloc(sizeof(long long) * m);
  for (i = 0; i < n; i++) {
    scanf("%lld", &x[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%lld", &y[i]);
  }

  long long sum = 0;

  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      for (k = 0; k < m; k++) {
        for (l = 0; l < m; l++) {
          if (x[i] >= 1 && x[i] <= 1000000000 && x[i] < x[j] && x[j] >= 1 && x[j] <= 1000000000) {
            if (y[k] >= 1 && y[k] <= 1000000000 && y[k] < y[l] && y[l] >= 1 && y[l] <= 1000000000) {
              //printf("%lld\n", (x[j] - x[i]) * (y[l] - y[k]));
              sum += (x[j] - x[i]) * (y[l] - y[k]);
            }
          }
        }
      }
    }
  }
  printf("%lld\n", sum % 1000000007);
  free(x);
  free(y);
  return 0;
}
