#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double PI = acos(-1.0);
int n, m;
int x[100000], y[100000];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  long long sum = (n - 1) * (m - 1) % MOD;
  long long s =
      (((abs(x[n - 1] - x[0])) % MOD) * ((abs(y[m - 1] - y[0])) % MOD)) % MOD;
  long long ans = ((sum) * (s)) % MOD;
  cout << ans << endl;
}
