#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  vector<long long> y(m);
  for (int i = 0; i < m; i++) {
    cin >> y[i];
  }
  long long total = 0;
  for (int l = 0; l < m - 1; l++) {
    for (int k = 0; k < n - 1; k++) {
      for (int i = k + 1; i < n; i++) {
        for (int j = l + 1; j < m; j++) {
          total += ((x[i] - x[k]) * (y[j] - y[l])) % 1000000007;
          total %= 1000000007;
        }
      }
    }
  }
  cout << total << endl;
}
