#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n);
  vector<long long> diff_x(n, 0);
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (long long i = 1; i < n; i++) {
    diff_x[i] = (x[i] - x[i - 1]) % 1000000007;
  }
  vector<long long> y(m);
  vector<long long> diff_y(m, 0);
  for (long long i = 0; i < m; i++) {
    cin >> y[i];
  }
  for (long long i = 1; i < m; i++) {
    diff_y[i] = (y[i] - y[i - 1]) % 1000000007;
  }
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j < m; j++) {
      long long pattern = i * (n - i) * j * (m - j);
      long long square = diff_x[i] * diff_y[j];
      ans += (pattern % 1000000007) * (square % 1000000007) % 1000000007;
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
}
