#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  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];
  }
  long long ans = 0;
  for (int(i) = 0; (i) < (n - 1); ++(i)) {
    for (int(j) = 0; (j) < (m - 1); ++(j)) {
      long long xLen = x[i + 1] - x[i];
      long long yLen = y[j + 1] - y[j];
      long long area = xLen * yLen % 1000000007;
      long long ySelectDown = j + 1;
      long long ySelectUp = m - 1 - j;
      long long xSelectLeft = i + 1;
      long long xSelectRight = n - 1 - i;
      long long ySelect = ySelectDown * ySelectUp % 1000000007;
      long long xSelect = xSelectLeft * xSelectRight % 1000000007;
      long long select = ySelect * xSelect % 1000000007;
      ans += area * select % 1000000007;
    }
  }
  ans %= 1000000007;
  cout << ans << endl;
}
