#include <bits/stdc++.h>
using namespace std;
template <typename T>
void DEBUG(T e) {
  if (true == false) return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v) {
  if (true == false) return;
  for (const auto &e : v) {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T> > &vv) {
  if (true == false) return;
  for (const auto &v : vv) {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e) {
  if (true == false) return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge) {
  if (flg) {
    cout << hoge << endl;
    exit(0);
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}
struct mint {
  long long x;
  mint(long long x = 0) : x((x % 1000000007 + 1000000007) % 1000000007) {}
  mint &operator+=(const mint a) {
    if ((x += a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += 1000000007 - a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= 1000000007;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(1000000007 - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
const long long MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
long long PERM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[n - k] % 1000000007) % 1000000007;
}
long long MCOM(long long n, long long k) { return COM(n + k - 1, k); }
long long fn(long long N, long long K) {
  long long fN = N / 2;
  long long odd_flag = N % 2;
  long long D = abs(fN + odd_flag - K);
  if (N % 2 == 0 && K < fN) D++;
  long long res = (fN + 1) * (fN);
  res -= (D - 1) * D;
  if (odd_flag == 1) {
    res += fN + 1 - D;
  }
  return res;
}
void solve(void) {
  long long H, W;
  cin >> H >> W;
  vector<long long> X(H, 0);
  vector<long long> Y(H, 0);
  vector<long long> dX(H, 0);
  vector<long long> dY(H, 0);
  for (long long i = 0; i < H; i++) {
    cin >> X[i];
    ;
  }
  for (long long i = 0; i < W; i++) {
    cin >> Y[i];
  }
  for (long long i = 0; i < H - 1; i++) {
    dX[i] = X[i + 1] - X[i];
    dX[i] *= fn(H - 1, i + 1);
  }
  for (long long i = 0; i < H - 1; i++) {
    dY[i] = Y[i + 1] - Y[i];
    dY[i] *= fn(W - 1, i + 1);
  }
  mint S1 = 0, S2 = 0;
  for (long long i = 0; i < H; i++) {
    S1 += dX[i];
  }
  for (long long i = 0; i < H; i++) {
    S2 += dY[i];
  }
  mint ANS = 1;
  ANS = S1 * S2;
  cout << ANS.x << endl;
  return;
}
int32_t main(int32_t argc, const char *argv[]) {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  return 0;
}
