#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
void solve();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}
void out() { cout << endl; }
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u)) cout << " ";
  out(u...);
}
void solve();
const ll MOD = 1000000007;
ll helper(vll& v) {
  ll n = (ll)(v.size());
  for (long long i = 0; i < n; i++) v[i] = (v[i] + MOD) % MOD;
  vll sum(n + 1, 0);
  for (long long i = 0; i < n; i++) sum[i + 1] = (sum[i] + v[i]) % MOD;
  ll a = 0;
  for (long long i = 0; i < n - 1; i++)
    a = (a + (((i + 1) * v[i]) % MOD)) % MOD;
  ll b = 0;
  for (long long i = 0; i < n; i++) b = (b + sum[i]) % MOD;
  ll ret = ((n - 1) * sum[n]) % MOD;
  ret = (ret + MOD - b) % MOD;
  ret = (ret + MOD - ((n * sum[n - 1]) % MOD)) % MOD;
  ret = (ret + a) % MOD;
  return ret;
}
void solve() {
  ll n, m;
  in(n, m);
  vll x(n);
  for (long long i = 0; i < n; i++) cin >> x[i];
  vll y(m);
  for (long long i = 0; i < n; i++) cin >> y[i];
  out((helper(x) * helper(y)) % MOD);
}
