#include <bits/stdc++.h>
using namespace std;
const long long INF = 300000000;
const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, m;
  cin >> n >> m;
  long long po = (n - 1) * (m - 1);
  long long x[100000];
  long long y[100000];
  long long ans = 0;
  for (int i = 0; i < n; ++i) cin >> x[i];
  for (int i = 0; i < n; ++i) cin >> y[i];
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < m - 1; ++j) {
      (ans += (abs(x[i + 1] - x[i])) * (abs(y[j + 1] - y[j])) * po) %= MOD;
    }
  }
  cout << ans << endl;
}
