#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using vl = vector<ll>;
using Map = map<ll, ll>;
using T = tuple<ll, ll, ll>;
using vvl = vector<vector<ll>>;
template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
signed main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll m;
  cin >> m;
  vector<ll> x(n, 0);
  vector<ll> y(m, 0);
  for (ll i = 0; i < n; ++i) cin >> x[i];
  for (ll i = 0; i < m; ++i) cin >> y[i];
  ll X = 0, Y = 0;
  for (ll i = 1; i <= n - 1; ++i) {
    X += ((((x[i] - x[i - 1]) % MOD) * i % MOD) * (n - i)) % MOD;
  }
  for (ll i = 1; i <= m - 1; ++i) {
    Y += ((((y[i] - y[i - 1]) % MOD) * i % MOD) * (m - i)) % MOD;
  }
  cout << X * Y % MOD << "\n";
  return 0;
}
