#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, x[100000], y[100000];
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (long long int i = 0; i < m; i++) {
    cin >> y[i];
  }
  long long int men = ((x[n - 1] - x[0]) * (y[m - 1] - y[0])) % 1000000007;
  long long int b = ((m - 2) + (n - 2) + 1) % 1000000007;
  long long int a = ((n - 2) * (m - 2)) % 1000000007;
  long long int c = (a + b) % 1000000007;
  men = men * (b + a) % 1000000007;
  cout << men;
  return 0;
}
