#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
long double PI = 3.14159265;
using ll = long long;
const ll modo = 1e9 + 7;
const ll ms = 1e6 + 5;
const ll inf = 1e17;
ll ar[ms];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  ll n, m;
  cin >> n >> m;
  int i;
  ll ss = 0;
  ll a = 0;
  ll b = 0;
  for (i = 1; i <= n; i++) {
    cin >> ar[i];
    ss += ar[i];
    ss += modo;
    ss %= modo;
  }
  for (i = 1; i <= n; i++) {
    ss = (ss + modo - ar[i]) % modo;
    a += (ss + modo - ((ar[i] * (n - i)) % modo));
    a %= modo;
  }
  ss = 0;
  for (i = 1; i <= m; i++) {
    cin >> ar[i];
    ss += ar[i];
    ss += modo;
    ss %= modo;
  }
  for (i = 1; i <= n; i++) {
    ss = (ss + modo - ar[i]) % modo;
    b += (ss + modo - ((ar[i] * (m - i)) % modo));
    b %= modo;
  }
  cout << (a * b) % modo;
  return 0;
}
