#include <bits/stdc++.h>
using namespace std;
template <class T>
using vv = vector<vector<T>>;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "{";
  for (int(i) = 0; (i) < (t.size()); ++(i)) {
    os << t[i] << ",";
  }
  os << "}" << endl;
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
const int MAX_N = 1e5;
const long long MOD = 1e9 + 7;
int main() {
  int n, m;
  static int x[MAX_N], y[MAX_N];
  cin >> n >> 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;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < m - 1; ++j) {
      ans += ((i + 1) * (j + 1) % MOD) * ((n - i - 1) * (m - j - 1) % MOD) *
             ((((x[i + 1] - x[i]) % MOD) * ((y[j + 1] - y[j]) % MOD)) % MOD) %
             MOD;
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
