#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
using vp = vector<pair<T, U>>;
template <class T>
using vv = vector<vector<T>>;
template <class T, class U>
using vvp = vv<pair<T, U>>;
template <class T>
vv<T> vvec(size_t n, size_t m, T v) {
  return vv<T>(n, vector<T>(m, v));
}
template <class T>
bool chmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
constexpr int INF = 1 << 28, MAX = 1e5 + 5, MOD = 1e9 + 7;
constexpr long long LINF = 1ll << 60;
constexpr double EPS = 1e-6;
constexpr int dy[4] = {0, 1, 0, -1}, dx[4] = {1, 0, -1, 0};
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  };
} aaaa;
int N, M;
vector<long long> X, Y;
int main() {
  cin >> N >> M;
  X.resize(N);
  Y.resize(M);
  for (int i = int(0), i_len = (N); i < i_len; ++i) cin >> X[i];
  for (int i = int(0), i_len = (M); i < i_len; ++i) cin >> Y[i];
  vector<long long> dxsum(N);
  dxsum[1] = (X[1] - X[0]) % MOD;
  long long xsum = dxsum[1];
  for (int i = int(2), i_len = (N); i < i_len; ++i) {
    dxsum[i] = dxsum[i - 1] + (X[i] - X[i - 1]) % MOD * i;
    dxsum[i] %= MOD;
    xsum += dxsum[i];
    xsum %= MOD;
  }
  vector<long long> dysum(N);
  dysum[1] = (Y[1] - Y[0]) % MOD;
  long long ysum = dysum[1];
  for (int i = int(2), i_len = (M); i < i_len; ++i) {
    dysum[i] = dysum[i - 1] + (Y[i] - Y[i - 1]) % MOD * i;
    dysum[i] %= MOD;
    ysum += dysum[i];
    ysum %= MOD;
  }
  cout << (xsum * ysum % MOD) << "\n";
}
