#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long a[n], b[m];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int ans = (a[n - 1] - a[0]) * (b[m - 1] - b[0]) % 1000000007;
  ans = ans * (n - 1) % 1000000007;
  ans = ans * (m - 1) % 1000000007;
  cout << ans;
}
