#include <bits/stdc++.h>
using namespace std;
constexpr uint64_t mod = 1e9 + 7;

int64_t calc(const vector<int> &x) {
  int64_t ans = 0;
  for (size_t i = 1; i <= x.size() - 1; ++i) {
    int w = x[i] - x[i - 1];
    ans = (ans + w * i * (x.size() - i)) % mod;
  }
  return ans;
}

int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<int> x(n), y(m);
  for (auto &e : x)
    cin >> e;
  for (auto &e : y)
    cin >> e;
  cout << (calc(x) * calc(y)) % mod << "\n";
}
