#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
int n, m;
const int MOD = 1e9 + 7;
long long calc(int num) {
  VI A(num);
  for (int i = 0; i < (int)num; ++i) cin >> A[i];
  long long res = 0;
  for (int i = 1; i < (int)num; ++i) {
    res += (long long)((A[i] - A[i - 1]) * i % MOD * (num - i));
    res %= MOD;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  long long sumX = calc(n), sumY = calc(m);
  cout << (sumX * sumY) % MOD << endl;
  return 0;
}
