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