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