#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool smin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool smax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const long long N = (long long)1e5 + 10, mod = (long long)1e9 + 7;
long long n, sum = 0, resx, resy, m;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long j = 0; j < n; ++j) {
    long long x;
    cin >> x;
    resx += j * x % mod - sum;
    if (resx < 0) resx += mod;
    if (resx >= mod) resx -= mod;
    sum += x;
    if (sum >= mod) sum -= mod;
  }
  sum = 0;
  for (long long j = 0; j < m; ++j) {
    long long x;
    cin >> x;
    resy += j * x % mod - sum;
    if (resy < 0) resy += mod;
    if (resy >= mod) resy -= mod;
    sum += x;
    if (sum >= mod) sum -= mod;
  }
  cout << resx * resy % mod << '\n';
}
