#include <bits/stdc++.h>
using namespace std;
int main() {
  const long long divisor = 1000000007;
  const int ARRAY_MAX_SIZE = 1000000;
  int n, m;
  cin >> n >> m;
  long long X[ARRAY_MAX_SIZE];
  for (int i = 0; i < n; i++) cin >> X[i];
  long long Y[ARRAY_MAX_SIZE];
  for (int i = 0; i < m; i++) cin >> Y[i];
  long long total_area = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      long long area = 0;
      area = (X[i] - X[i - 1]) * (Y[j] - Y[j - 1]) % divisor;
      area = area * i * (n - i) * j * (m - j);
      total_area = (total_area + area) % divisor;
    }
  cout << total_area << endl;
}
