#include <bits/stdc++.h>
using namespace std;
int c(int, int);
int main() {
  long int n, m;
  cin >> n >> m;
  long int x[n], y[m];
  for (long int i = (0); i < ((n)); i++) cin >> x[i];
  for (long int i = (0); i < ((m)); i++) cin >> y[i];
  long int L = (x[n - 1] - x[0]) * (y[m - 1] - y[0]) % 1000000007;
  long int A = 0;
  for (int i = 0; i <= n - 2; i++) {
    A += c(n - 2, i);
    A %= 1000000007;
  }
  long int B = 0;
  for (int i = 0; i <= m - 2; i++) {
    B += c(m - 2, i);
    B %= 1000000007;
  }
  cout << (L * A * B) % 1000000007 << endl;
  return 0;
}
int c(int x, int b) {
  int a = 1;
  for (long int q = (0); q < ((b)); q++) a *= (x - q);
  for (long int q = (0); q < ((b)); q++) a /= q + 1;
  return a;
}
