#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m;
  cin >> n >> m;
  long long a[n], b[m], ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < m; j++) {
    cin >> b[j];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < m; j++) {
      ans += (a[i] - a[i - 1]) * (n - i) * i % 1000000007 * (b[j] - b[j - 1]) *
             (m - j) * j % 1000000007;
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
