#include <bits/stdc++.h>
using namespace std;
unsigned long long ans(int n, int m, const vector<long long>& x_vec,
                       const vector<long long>& y_vec) {
  unsigned long long ret = 0;
  unsigned long long w = 0;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < (n - i); ++j) {
      w += abs(x_vec.at(j + i) - x_vec.at(j)) % 1000000007;
    }
  }
  for (int i = 1; i < m; ++i) {
    unsigned long long h = 0;
    for (int j = 0; j < (m - i); ++j) {
      h += abs(y_vec.at(j + i) - y_vec.at(j)) % 1000000007;
    }
    ret = (ret + (w * h % 1000000007)) % 1000000007;
  }
  return ret;
};
int main() {
  int n, m;
  vector<long long> x_vec, y_vec;
  long long buf;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> buf;
    x_vec.push_back(buf);
  }
  for (int i = 0; i < m; ++i) {
    cin >> buf;
    y_vec.push_back(buf);
  }
  cout << ans(n, m, x_vec, y_vec) << endl;
  return 0;
}
