#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 < (long long)(n); i++) cin >> x[i];
  for (long long i = (0); i < (long long)(m); i++) cin >> y[i];
  long long ans = 0;
  constexpr long long mod = 1e9 + 7;
  for (long long i = (0); i < (long long)(m - 1); i++) {
    for (long long j = (0); j < (long long)(n - 1); j++) {
      long long L = j;
      long long R = (n - 1) - j;
      long long D = i;
      long long U = (m - 1) - i;
      long long area = (x[j + 1] - x[j]) * (y[i + 1] - y[i]);
      area %= mod;
      ans += ((area * R) % mod) * (((1 + L) * U * (1 + D)) % mod);
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
