#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N, M;
  cin >> N >> M;
  vector<long long> x(N);
  vector<long long> y(N);
  for (long long i = 0; i < N; i++) {
    cin >> x[i];
  }
  for (long long j = 0; j < M; j++) {
    cin >> y[j];
  }
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = 0; j < M - 1; j++) {
      long long sum = 1LL;
      sum *= (x[i + 1] - x[i]) * (y[j + 1] - y[j]) % MOD;
      sum *= (i + 1) * (N - (i + 1)) % MOD;
      sum *= (j + 1) * (M - (j + 1)) % MOD;
      ans += sum;
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
