#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.at(i);
  }
  for (int i = 0; i < M; i++) {
    cin >> Y.at(i);
  }
  long long sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = 0; k < M - 1; k++) {
        for (int l = k + 1; l < M; l++) {
          sum += (X.at(j) - X.at(i)) * (Y.at(l) - Y.at(k));
          sum %= 1000000007;
        }
      }
    }
  }
  cout << sum << endl;
}
