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