#include <bits/stdc++.h>
using namespace std;
int tyou(int t, int s, vector<int> v) {
  if (t == 0)
    return 0;
  else if (t == 1)
    return s;
  else {
    return (tyou(t - 1, s, v) +
            (tyou(t - 1, s, v) / (v.at(t - 1) - v.at(0))) *
                (v.at(t) - v.at(1)) +
            (s / (v.at(1) - v.at(0))) * (v.at(t) - v.at(0))) %
           1000000007;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n);
  int y[m], sum = 0;
  for (int i = 0; i < n; i++) cin >> x.at(i);
  for (int i = 0; i < m; i++) cin >> y[i];
  for (int i = 0; i < m - 1; i++) {
    for (int j = i + 1; j < m; j++) {
      sum += (x.at(1) - x.at(0)) * (y[j] - y[i]);
      sum %= 1000000007;
    }
  }
  cout << tyou(n - 1, sum, x) << endl;
}
