#include <bits/stdc++.h>
using namespace std;
void set_values(const long long int& x, long long int arr[]) {
  int i, len = x / 2;
  for (i = 0; i < len; i++) arr[i] = arr[x - i - 1] = (x - i) * (i + 1);
  if (x % 2 == 1) arr[len] = (x - i) * (i + 1);
}
int main() {
  long long int n, m, ans = 0, mod = 1000000007;
  cin >> n >> m;
  long long int tmp_n = n - 1, tmp_m = m - 1;
  long long int n_val[tmp_n], m_val[tmp_m];
  set_values(tmp_n, n_val);
  set_values(tmp_m, m_val);
  long long int y_axis[n], x_curr, x_next, len_x, len_y, save = 0;
  for (int i = 0; i < n; i++) cin >> y_axis[i];
  cin >> x_curr >> x_next;
  len_x = (x_next - x_curr) % mod;
  for (int i = 0; i < tmp_n; i++) {
    len_y = (y_axis[i + 1] - y_axis[i]) % mod;
    ans += (((len_x * len_y) % mod) * ((n_val[i] * m_val[save]) % mod)) % mod;
    ans %= mod;
  }
  save++;
  for (int i = 2; i < m; i++) {
    x_curr = x_next;
    cin >> x_next;
    len_x = (x_next - x_curr) % mod;
    for (int j = 0; j < tmp_n; j++) {
      len_y = (y_axis[j + 1] - y_axis[j]) % mod;
      ans += (((len_x * len_y) % mod) * ((n_val[j] * m_val[save]) % mod)) % mod;
      ans %= mod;
    }
    save++;
  }
  cout << ans;
}
