#include <bits/stdc++.h>
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  int x[n], y[m];
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &y[i]);
  }
  unsigned long long side = (x[n - 1] - x[0]), high = (y[m - 1] - y[0]), S;
  side %= 1000000007;
  high %= 1000000007;
  S = side * high;
  S %= 1000000007;
  unsigned long long t = ((n - 1) % 1000000007) * ((m - 1) % 1000000007);
  t %= 1000000007;
  unsigned long long ans = 0;
  for (int i = 0; i < t; i++) {
    ans += S;
    ans = ans % 1000000007;
  }
  printf("%llu\n", ans);
  return 0;
}
