#include <bits/stdc++.h>
using namespace std;
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}
const int INF = (1e9);
const long long MOD = 1e9 + 7;
const double EPS = 1e-5;
const double PI = atan2(0, -1);
int solve() {}
int main(void) {
  int n, m;
  long long dx, dy, x, y;
  unsigned long long int ans;
  cin >> n >> m;
  cin >> x;
  dx = -x;
  for (int i = (0); i < (n - 1); ++i) {
    cin >> x;
  }
  dx += x;
  cin >> y;
  dy = -y;
  for (int i = (0); i < (m - 1); ++i) {
    cin >> y;
  }
  dy += y;
  ans = ((dx * dy) % MOD * (n - 1) * (m - 1)) % MOD;
  cout << ans << endl;
}
