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