#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const long long MOD = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> X(n), Y(m);
  for (int i = 0; i < (int)(n); i++) cin >> X[i];
  for (int i = 0; i < (int)(m); i++) cin >> Y[i];
  long long ans = 0;
  for (int i = 0; i < (int)(n - 1); i++)
    for (int j = 0; j < (int)(m - 1); j++) {
      long long temp = (long long)(X[i + 1] - X[i]) * (Y[j + 1] - Y[j]);
      temp %= MOD;
      temp *= (i + 1) * (n - i - 1);
      temp %= MOD;
      temp *= (j + 1) * (m - j - 1);
      temp %= MOD;
      ans += temp;
      ans %= MOD;
    }
  cout << ans << endl;
  return 0;
}
