#include <bits/stdc++.h>
using namespace std;
using VS = vector<string>;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
using VL = vector<LL>;
using VVL = vector<VL>;
const int INF = 1e9;
const LL LINF = 1e16;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
int DX[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int DY[8] = {1, -1, 0, 0, 1, -1, 1, -1};
LL H, W;
LL ans = 0LL;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> W >> H;
  VL x(W);
  for (int(i) = (0); (i) < (W); (i)++) {
    cin >> x[i];
  }
  VL y(H);
  for (int(i) = (0); (i) < (H); (i)++) {
    cin >> y[i];
  }
  LL xsum = 0, bef;
  for (int(i) = (1); (i) < (W); (i)++) {
    (xsum += bef) %= MOD;
    (xsum += (x[i] - x[i - 1]) * i % MOD) %= MOD;
    (bef += (x[i] - x[i - 1]) * i % MOD) %= MOD;
  }
  bef = 0;
  LL ysum = 0;
  for (int(i) = (1); (i) < (H); (i)++) {
    (ysum += bef) %= MOD;
    (ysum += (y[i] - y[i - 1]) * i % MOD) %= MOD;
    (bef += (y[i] - y[i - 1]) * i % MOD) %= MOD;
  }
  ans = (xsum * ysum) % MOD;
  return 0;
}
