#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template <class T>
void print(T x, bool cl = 1) {
  cout << (cl ? "\x1b[36m" : "") << x << (cl ? "\x1b[39m" : "") << '\n';
}
template <class T>
void print1d(T x, ll n = -1, bool cl = true) {
  if (n == -1) n = x.size();
  for (long long i = 0; i < n; ++i) {
    cout << (cl ? "\x1b[36m" : "") << x[i] << (i == n - 1 ? '\n' : ' ');
  }
  cout << (cl ? "\x1b[39m" : "");
}
template <class T>
void print2d(T x, ll r = -1, ll c = -1, bool cl = 1) {
  if (r == -1) r = x.size();
  if (c == -1) c = x[0].size();
  for (long long i = 0; i < r; ++i) print1d(x[i], c, cl);
}
template <class T, class U>
bool haskey(T mp, U key) {
  return mp.find(key) != mp.end();
}
template <class T, class U>
bool isin(T el, U container) {
  return find((container).begin(), (container).end(), el) != container.end();
}
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool even(T n) {
  return !(n & 1);
}
template <class T>
bool odd(T n) {
  return n & 1;
}
template <class T>
ll rup(T a, T b) {
  return a % b ? a / b + 1 : a / b;
}
template <class T>
ld deg2rad(T deg) {
  return M_PI * deg / 180.0;
}
template <class T>
ld rad2deg(T rad) {
  return 180.0 * rad / M_PI;
}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod = numeric_limits<ll>::max()) {
  ll p = 1;
  while (n) {
    if (n & 1) p = p * a % _mod;
    a = a * a % _mod;
    n >>= 1;
  }
  return p;
}
ll modc(ll a, char op, ll b, ll _mod = mod) {
  a %= _mod;
  b %= _mod;
  ll res = 1;
  switch (op) {
    case '+':
      res = (a + b) % _mod;
      break;
    case '-':
      res = (a - b) % _mod;
      break;
    case '*':
      res = a * b % _mod;
      break;
    case '/':
      res = modc(a, '*', modc(b, '^', _mod - 2, _mod), _mod);
      break;
    case '^':
      res = intpow(a, b, _mod);
      break;
    case 'P':
      for (long long i = a - b + 1; i < a + 1; ++i)
        res = modc(res, '*', i, _mod);
      break;
    case 'C':
      res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod));
      break;
  }
  if (res < 0) {
    res += _mod;
  }
  return res;
}
int main() {
  ll n, m;
  cin >> n >> m;
  vll xx(n), yy(m);
  for (long long i = 0; i < n; ++i) cin >> xx[i];
  for (long long i = 0; i < m; ++i) cin >> yy[i];
  vll dx(n - 1), dy(m - 1);
  for (long long i = 0; i < n - 1; ++i) dx[i] = xx[i + 1] - xx[i];
  for (long long i = 0; i < m - 1; ++i) dy[i] = yy[i + 1] - yy[i];
  vllvll s(m - 1, vll(n - 1));
  for (long long y = 0; y < m - 1; ++y) {
    for (long long x = 0; x < n - 1; ++x) {
      s[y][x] = dy[y] * dx[x];
    }
  }
  ll ans = 0;
  for (long long y = 1; y < m; ++y) {
    for (long long x = 1; x < n; ++x) {
      ll tmp = modc(y * (m - y), '*', x * (n - x));
      tmp = modc(tmp, '*', s[y - 1][x - 1]);
      ans = modc(ans, '+', tmp);
    }
  }
  cout << ans << endl;
}
