#include <bits/stdc++.h>
using namespace std;
const long long int M = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  long long int x[n], y[m];
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  vector<long long int> X(n / 2), Y(m / 2);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) X.push_back(x[j] - x[i]);
  for (int i = 0; i < m; i++)
    for (int j = i + 1; j < m; j++) Y.push_back(y[j] - y[i]);
  long long int ans = 0;
  for (auto it1 = begin(X); it1 != end(X); it1++) {
    for (auto it2 = begin(Y); it2 != end(Y); it2++) {
      ans += (((*it1) % M) * ((*it2) % M)) % M;
      ans %= M;
    }
  }
  cout << ans << endl;
}
