#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;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  int prev;
  long long sumX = 0, sumY = 0;
  cin >> prev;
  for (int i = 0; i < (int)n - 1; ++i) {
    int x;
    cin >> x;
    sumX += x - prev;
    sumX %= MOD;
    prev = x;
  }
  cin >> prev;
  for (int i = 0; i < (int)m - 1; ++i) {
    int y;
    cin >> y;
    sumY += y - prev;
    sumY %= MOD;
    prev = y;
  }
  cout << (sumX * sumY) % MOD << endl;
  return 0;
}
