#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1000000007;
struct mint {
  int64_t rep;
  mint(int64_t x = 0) : rep(((x % MOD) + MOD) % MOD) {}
  mint operator-() const { return mint(-rep); }
  mint& operator+=(const mint& x) {
    rep += x.rep;
    if (rep >= MOD) rep -= MOD;
    return *this;
  }
  mint& operator-=(const mint& x) {
    rep -= x.rep;
    if (rep < 0) rep += MOD;
    return *this;
  }
  mint& operator*=(const mint& x) {
    rep *= x.rep;
    rep %= MOD;
    return *this;
  }
  mint operator+(const mint x) const {
    mint ans(*this);
    ans += x;
    return ans;
  }
  mint operator-(const mint x) const {
    mint ans(*this);
    ans -= x;
    return ans;
  }
  mint operator*(const mint x) const {
    mint ans(*this);
    ans *= x;
    return ans;
  }
  mint pow(int64_t d) const {
    if (d == 0)
      return 1;
    else {
      mint ans = pow(d >> 1);
      ans *= ans;
      if (d & 1) {
        ans *= *this;
      }
      return ans;
    }
  }
  friend istream& operator>>(istream& is, mint& x) noexcept {
    int64_t a;
    is >> a;
    x = a;
    return is;
  }
  friend ostream& operator<<(ostream& os, const mint& x) noexcept {
    return os << x.rep;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint& x) {
    *this *= x.inv();
    return *this;
  }
  mint operator/(const mint x) const {
    mint ans(*this);
    ans /= x;
    return ans;
  }
};
int main() {
  int Nx, Ny;
  cin >> Nx >> Ny;
  vector<int64_t> data_x(Nx);
  vector<int64_t> data_y(Ny);
  for (int i = 0; i < Nx; i++) {
    cin >> data_x.at(i);
  }
  for (int j = 0; j < Ny; j++) {
    cin >> data_y.at(j);
  }
  mint ans = 0;
  for (int64_t i = 0; i + 1 < Nx; i++) {
    for (int64_t j = 0; j + 1 < Ny; j++) {
      mint Sij =
          (data_x.at(i + 1) - data_x.at(i)) * (data_y.at(j + 1) - data_y.at(j));
      mint pattern = (i + 1) * (Nx - i - 1) * (j + 1) * (Ny - j - 1);
      ans += pattern * Sij;
    }
  }
  cout << ans << endl;
}
