#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> X(N);
  vector<long long> Y(M);
  for (int i = 0; i < N; i++) cin >> X[i];
  for (int i = 0; i < M; i++) cin >> Y[i];
  long long ans = 0;
  long long tate = 0;
  for (long long i = 1; i < M; i++) {
    tate += (i * (M - i) % MOD) * (Y[i] - Y[i - 1]) % MOD;
  }
  for (long long i = 1; i < N; i++) {
    ans += ((i * (N - i) % MOD) * (X[i] - X[i - 1]) % MOD) * tate % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
