#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 6;
const long long MOD = 1e9 + 7;
const long long LLINF = 1LL << 60;
int main() {
  long long n, m;
  cin >> n >> m;
  long long x[n], y[m];
  for (int i = int(0); i < int(n); i++) cin >> x[i];
  for (int i = int(0); i < int(m); i++) cin >> y[i];
  long long sumx[n + 1], sumy[n + 1];
  sumx[0] = 0, sumy[0] = 0;
  for (int i = int(0); i < int(n); i++) sumx[i + 1] = (x[i] + sumx[i]) % MOD;
  for (int i = int(0); i < int(m); i++) sumy[i + 1] = (y[i] + sumy[i]) % MOD;
  long long ansx = 0, ansy = 0;
  for (int i = int(0); i < int(n - 1); i++) {
    ansx = (10 * MOD + ansx + sumx[n] - sumx[i + 1] -
            (n - 1 - long long(i)) * x[i] % MOD) %
           MOD;
  }
  for (int i = int(0); i < int(m - 1); i++) {
    ansy = (10 * MOD + ansy + sumy[m] - sumy[i + 1] -
            (m - 1 - long long(i)) * y[i] % MOD) %
           MOD;
  }
  cout << ansx * ansy % MOD << endl;
}
