#include <bits/stdc++.h>
using namespace std;
struct mint {
  typedef decay<decltype(1000000007)>::type T;
  T v;
  explicit operator T() const { return v; }
  mint() { v = 0; }
  mint(long long _v) {
    v = (-1000000007 < _v && _v < 1000000007) ? _v : _v % 1000000007;
    if (v < 0) v += 1000000007;
  }
  friend bool operator==(const mint& a, const mint& b) { return a.v == b.v; }
  friend bool operator!=(const mint& a, const mint& b) { return !(a == b); }
  friend bool operator<(const mint& a, const mint& b) { return a.v < b.v; }
  mint& operator+=(const mint& m) {
    if ((v += m.v) >= 1000000007) v -= 1000000007;
    return *this;
  }
  mint& operator-=(const mint& m) {
    if ((v -= m.v) < 0) v += 1000000007;
    return *this;
  }
  mint& operator*=(const mint& m) {
    v = (long long)v * m.v % 1000000007;
    return *this;
  }
  mint& operator/=(const mint& m) { return (*this) *= inv(m); }
  friend mint pow(mint a, long long p) {
    mint ans = 1;
    assert(p >= 0);
    for (; p; p /= 2, a *= a)
      if (p & 1) ans *= a;
    return ans;
  }
  friend mint inv(const mint& a) {
    assert(a.v != 0);
    return pow(a, 1000000007 - 2);
  }
  mint operator-() const { return mint(-v); }
  mint& operator++() { return *this += 1; }
  mint& operator--() { return *this -= 1; }
  friend mint operator+(mint a, const mint& b) { return a += b; }
  friend mint operator-(mint a, const mint& b) { return a -= b; }
  friend mint operator*(mint a, const mint& b) { return a *= b; }
  friend mint operator/(mint a, const mint& b) { return a /= b; }
};
vector<long long> a, b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, t, m, z;
  mint ans = 0;
  cin >> n >> m;
  for (int e = 0; e < n; e++) {
    long long y;
    cin >> y;
    a.push_back(y);
  };
  for (int e = 0; e < m; e++) {
    long long y;
    cin >> y;
    b.push_back(y);
  };
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      mint x = a[i + 1] - a[i];
      mint y = b[j + 1] - b[j];
      ans += (x * y) * (i + 1) * (n - i - 1) * (j + 1) * (m - j - 1);
    }
  }
  cout << ans.v;
  return 0;
}
