#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll, ll, ll>>;
using vb = vector<bool>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1e15;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
void add(ll& a, ll b) { a = (a + b) % MOD; }
void mul(ll& a, ll b) { a = (a * b) % MOD; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  ll pre;
  cin >> pre;
  vll a(n - 1);
  for (long long i = (long long)(0); i < (long long)(n - 1); ++i) {
    ll x;
    cin >> x;
    a[i] = x - pre;
    pre = x;
  }
  cin >> pre;
  vll b(m - 1);
  for (long long i = (long long)(0); i < (long long)(m - 1); ++i) {
    ll y;
    cin >> y;
    b[i] = y - pre;
    pre = y;
  }
  ll ans = 0;
  for (long long i = (long long)(0); i < (long long)(n - 1); ++i) {
    ll d = i, u = n - 2 - i;
    for (long long j = (long long)(0); j < (long long)(m - 1); ++j) {
      ll l = j, r = m - 2 - j;
      ll s = a[i] * b[j] % MOD;
      mul(s, l + 1);
      mul(s, r + 1);
      mul(s, u + 1);
      mul(s, d + 1);
      add(ans, s);
    }
  }
  cout << ans << endl;
}
