#include <bits/stdc++.h>
using namespace std;
int f(int k, int l) {
  if (k - l >= 0) {
    return (k - l);
  } else {
    return (l - k);
  }
}
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  int x[n];
  int y[m];
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> y[i];
  }
  long long int s = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      for (int k = 0; k < m; ++k) {
        for (int l = k; l < m; ++l) {
          s += f(x[i], x[j]) * f(y[k], y[l]);
          s = s % 1000000007;
        }
      }
    }
  }
  cout << s << "\n";
  return 0;
}
