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