#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  int n, m;
  long long answer = 0;
  long long xcalc = 0;
  cin >> n >> m;
  long long buf = 0;
  for (int i = 0; i < n; i++) {
    long long buf2;
    cin >> buf2;
    if (i > 0) {
      xcalc = (xcalc + ((((i * (n - i)) % MOD) * (buf2 - buf)) % MOD)) % MOD;
    }
    buf = buf2;
  }
  for (int i = 0; i < m; i++) {
    long long buf2;
    cin >> buf2;
    if (i > 0) {
      answer =
          (answer +
           (xcalc * ((((i * (m - i)) % MOD) * (buf2 - buf)) % MOD)) % MOD) %
          MOD;
    }
    buf = buf2;
  }
  cout << answer << endl;
}
