#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  ll mod = 1;
  for (int i = 0; i < 9; i++) mod *= 10;
  mod += 7;
  auto xs = vector<ll>(n);
  auto ys = vector<ll>(m);
  for (int i = 0; i < n; i++) cin >> xs[i];
  for (int i = 0; i < m; i++) cin >> ys[i];
  ll ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      ll xreps = (n - i - 1) * (i + 1);
      ll yreps = (m - j - 1) * (j + 1);
      ll area = (xs[i + 1] - xs[i]) * (ys[j + 1] - ys[j]);
      ll add = area * xreps * yreps % mod;
      ans += add;
      ans %= mod;
    }
  }
  cout << ans << endl;
}
