#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  long long int x[100000];
  long long int all = 0;
  long long int buff[2];
  cin >> n >> m;
  n--;
  m--;
  cin >> buff[0];
  for (int i = 0; i < n; i++) {
    cin >> buff[1];
    x[i] = buff[1] - buff[0];
    buff[0] = buff[1];
  }
  cin >> buff[0];
  for (int i = 0; i < m; i++) {
    long long int y;
    cin >> buff[1];
    y = buff[1] - buff[0];
    buff[0] = buff[1];
    for (int j = 0; j < n; j++) {
      long long int buff = x[j] % 10000000007;
      buff = (buff * y) % 10000000007;
      buff = (buff * (j + 1) * (n - j)) % 10000000007;
      buff = (buff * (i + 1) * (m - i)) % 10000000007;
      all += buff;
    }
  }
  cout << all << endl;
  return 0;
}
