#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long x[n], y[m];
  long long w[n - 1], h[m - 1];
  long long S, Si, Sj, sum, a, b;
  long long smax = (long long)1e9 + 7;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    if (i != 0) {
      w[i - 1] = x[i] - x[i - 1];
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> y[i];
    if (i != 0) {
      h[i - 1] = y[i] - y[i - 1];
    }
  }
  sum = 0;
  for (int i = 1; i <= n - 1; i++) {
    a = min((long long)i, (long long)n - i);
    Si = a * a + a * (n - 2 * a);
    for (int j = 1; j <= m - 1; j++) {
      b = min((long long)j, (long long)m - j);
      Sj = b * b + b * (m - 2 * b);
      S = (w[i - 1] * h[j - 1]) % smax;
      sum += ((Si * Sj * S) % smax);
      sum = sum % smax;
    }
  }
  cout << sum << endl;
  return 0;
}
