#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin >> N >> M;
  long fi,se;
  long sumx = 0;
  cin >> fi;
  for (int i=0; i<N-1; i++) {
    cin >> se;
    sumx += (se-fi) * (i+1) * (N-1-i);
    sumx %= 1000000007;
    fi = se;
  }
  long sumy = 0;
  cin >> fi;
  for (int i=0; i<M-1; i++) {
    cin >> se;
    sumy += (se-fi) * (i+1) * (M-1-i);
    sumy %= 1000000007;
    fi = se;
  }
  long total = sumx * sumy % 1000000007;
  cout << total << endl;
}