#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long mod = pow(10, 9) + 7;
  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 ans = 0;
  for (long long i = 0; i < N - 1; ++i) {
    long long U = i + 1, D = N - U;
    long long len_x = (X.at(i + 1) - X.at(i)) % mod;
    for (long long j = 0; j < M - 1; ++j) {
      long long len_y = (Y.at(j + 1) - Y.at(j)) % mod;
      long long L = j + 1, R = M - L;
      long long mul = (((((U * D) % mod) * L) % mod) * R) % mod;
      ans = (ans + (mul * (len_x * len_y % mod) % mod)) % mod;
    }
  }
  cout << ans << "\n";
}
