#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n);
  vector<long long> y(m);
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> y[i];
  }
  long long tmp;
  long long sum1 = 0;
  vector<long long> sumx(n, 0);
  vector<long long> sumy(m, 0);
  sumx[0] = x[0];
  for (long long i = 0; i < n; i++) {
    sumx[i + 1] = sumx[i] + x[i + 1];
  }
  sumy[0] = y[0];
  for (long long i = 0; i < m; i++) {
    sumy[i + 1] = sumy[i] + y[i + 1];
  }
  for (long long i = 0; i < n - 1; i++) {
    sum1 += ((x[i + 1] * (i + 1) - sumx[i])) % 1000000007;
    sum1 %= 1000000007;
  }
  long long sum2 = 0;
  for (long long i = 0; i < m - 1; i++) {
    sum2 += ((y[i + 1] * (i + 1) - sumy[i])) % 1000000007;
    sum2 %= 1000000007;
  }
  cout << (sum1 * sum2) % 1000000007 << endl;
  return 0;
}
