#include <bits/stdc++.h>
using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
inline void yes() {
  cout << "Yes" << '\n';
  exit(0);
}
inline void no() {
  cout << "No" << '\n';
  exit(0);
}
inline i64 gcd(i64 a, i64 b) {
  if (min(a, b) == 0) return max(a, b);
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(16);
  solve();
  return 0;
}
template <typename T>
class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T>
class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T>
inline void amax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
inline void amin(T &x, T y) {
  if (x > y) x = y;
}
template <typename T>
inline T power(T x, i64 n) {
  T r = 1;
  while (n > 0) {
    if (n & 1) r *= x;
    x *= x;
    n >>= 1;
  }
  return r;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < int(v.size()); i++) {
    if (i) os << ' ';
    os << v[i];
  }
  return os;
}
template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int a) {
    x = a % mod;
    if (x < 0) x += mod;
  }
  ModInt &operator+=(ModInt that) {
    x = (x + that.x) % mod;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    x = (x + mod - that.x) % mod;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = (i64)x * that.x % mod;
    return *this;
  }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt operator-() { return ModInt(-this->x); }
  friend ostream &operator<<(ostream &os, ModInt m) { return os << m.x; }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) {
      int t = a / b;
      a -= t * b;
      u -= t * v;
      swap(a, b);
      swap(u, v);
    }
    return ModInt(u);
  }
  ModInt operator+(ModInt that) { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) { return ModInt(*this) /= that; }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  bool operator<(ModInt that) const { return x < that.x; }
  bool operator<=(ModInt that) const { return x <= that.x; }
  bool operator>(ModInt that) const { return x > that.x; }
  bool operator>=(ModInt that) const { return x >= that.x; }
};
using mint = ModInt<1000000007>;
void solve() {
  int n, m;
  cin >> n >> m;
  vi32 x(n), y(m);
  cin >> x >> y;
  mint ansx = 0, ansy = 0;
  for (int i = 1; i <= int(n - 1); i++) {
    ansx += (mint)(n * i - i * i) * (x[i] - x[i - 1]);
  }
  for (int i = 1; i <= int(m - 1); i++) {
    ansy += (mint)(m * i - i * i) * (y[i] - y[i - 1]);
  }
  cout << ansx * ansy << '\n';
}
