#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<long long> x(n), y(m);
  for (int i = 0; i < n; i++) {
    cin >> x.at(i);
  }
  for (int i = 0; i < m; i++) {
    cin >> y.at(m);
  }
  long long sum = 0;
  for (long int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      sum += ((x.at(i + 1) - x.at(i)) * (y.at(j + 1) - y.at(j)) % 1000000007) *
             ((i + 1) * (j + 1) % 1000000007) *
             ((n - i - 1) * (m - j - 1) % 1000000007) % 1000000007;
      sum = sum % 1000000007;
    }
  }
  cout << sum << endl;
}
