#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using datas = pair<ll, ll>;
using tdata = pair<ll, datas>;
using vec = vector<ll>;
using mat = vector<vec>;
using pvec = vector<datas>;
using pmat = vector<pvec>;
long mmid(long a, long b, long c) {
  return a < b ? (b < c ? b : max(a, c)) : (b > c ? b : min(a, c));
}
ll modinv(ll a) {
  ll b = 1000000007, u = 1, v = 0, t;
  while (b) {
    t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  return (u + 1000000007) % 1000000007;
}
ll moddevide(ll a, ll b) { return (a * modinv(b)) % 1000000007; }
ll modncr(ll n, ll r) {
  ll i, plus = 1;
  for (i = 0; i < r; i++) {
    plus = (plus * (n - i)) % 1000000007;
    plus = moddevide(plus, i + 1);
  }
  return plus;
}
ll modncrlistp[200000], modncrlistm[200000];
ll modncrs(ll n, ll r) {
  ll i, j;
  if (modncrlistp[n] == 0) {
    for (i = n; i >= 0; i--) {
      if (modncrlistp[i]) break;
    }
    if (i < 0) {
      modncrlistp[0] = 1;
      for (i = 1; i < n + 1; i++) {
        modncrlistp[i] = (modncrlistp[i - 1] * i) % 1000000007;
      }
    } else {
      for (j = i + 1; j < n + 1; j++) {
        modncrlistp[j] = (modncrlistp[j - 1] * j) % 1000000007;
      }
    }
  }
  if (modncrlistm[n] == 0) {
    for (i = n; i >= 0; i--) {
      if (modncrlistm[i]) break;
    }
    if (i < 0) {
      modncrlistm[0] = 1;
      for (i = 1; i < n + 1; i++) {
        modncrlistm[i] = (modncrlistm[i - 1] * modinv(i)) % 1000000007;
      }
    } else {
      for (j = i + 1; j < n + 1; j++)
        modncrlistm[j] = (modncrlistm[j - 1] * modinv(j)) % 1000000007;
    }
  }
  return (((modncrlistp[n] * modncrlistm[r]) % 1000000007) *
          modncrlistm[n - r]) %
         1000000007;
}
ll gcd(ll a, ll b) {
  if (!b) return a;
  return (a % b == 0) ? b : gcd(b, a % b);
}
ll countdigits(ll n) {
  ll ans = 0;
  while (n) {
    n /= 10;
    ans++;
  }
  return ans;
}
ll sumdigits(ll n) {
  ll ans = 0;
  while (n) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}
vec eratosthenes(ll N) {
  ll i;
  vec ch(N + 1, 1), p;
  ch[0] = ch[1] = 0;
  for (i = 0; i < N + 1; i++) {
    if (ch[i]) {
      p.push_back(i);
      for (ll j = 2; i * j <= N; j++) {
        ch[i * j] = 0;
      }
    }
  }
  return ch;
}
int main() {
  ll i, bf, x, H, W, d, xans = 0, yans = 0;
  cin >> H >> W;
  cin >> bf;
  for (i = 1; i < H; i++) {
    cin >> x;
    d = (x - bf) % 1000000007;
    xans = (xans + d * i % 1000000007 * (H - i - 1) % 1000000007) % 1000000007;
    bf = x;
  }
  cin >> bf;
  for (i = 1; i < W; i++) {
    cin >> x;
    d = (x - bf) % 1000000007;
    yans = (yans + d * i % 1000000007 * (W - i - 1) % 1000000007) % 1000000007;
    bf = x;
  }
  cout << (xans * yans) % 1000000007 << "\n";
  return 0;
}
