#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  vector<long long> xv, yv;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    xv.push_back(x);
  }
  for (int i = 0; i < m; ++i) {
    long long y;
    cin >> y;
    yv.push_back(y);
  }
  long long ans = 0;
  for (long long i = 1; i <= n - 1; ++i)
    for (long long j = 1; j <= m - 1; ++j) {
      long long min_area = (xv[i] - xv[i - 1]) * (yv[j] - yv[j - 1]) % MOD;
      long long dup_cnt = i * (n - i) % MOD;
      dup_cnt = (j * (m - j) % MOD) * dup_cnt % MOD;
      ans = (min_area * dup_cnt % MOD + ans) % MOD;
    }
  cout << ans << "\n";
  return 0;
}
