#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<long> x(n);
  vector<long> y(m);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> y[i];
  }
  long t = 0;
  long tmp;
  for (int i = 0; i * 2 < n - 1; i++) {
    for (int j = 0; j * 2 < m - 1; j++) {
      tmp = (x[n - 1 - i] - x[i]) * (y[m - 1 - j] - y[j]);
      tmp %= (long)1E9 + 7;
      t += (n - 1 - 2 * i) * (m - 1 - 2 * j) * tmp;
      t %= (long)1E9 + 7;
    }
  }
  cout << t << endl;
}
