#include <bits/stdc++.h>
using namespace std;
int n, m;
long long int width[100000], height[100000];
void solve() {
  int plus_times;
  long long int S = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      if ((i == 0 || i == n - 2) && (j == 0 || j == m - 2)) {
        plus_times = (m - 1) * (n - 1);
      } else if (i == 0 || i == n - 2) {
        plus_times = m * (n - 1);
      } else if (j == 0 || j == m - 2) {
        plus_times = (m - 1) * n;
      } else {
        plus_times = m * n;
      }
      S += (width[i] * height[j] * plus_times) % 1000000007;
      S %= 1000000007;
    }
  }
  cout << S << endl;
}
int main(void) {
  long long int x, x1, y, y1;
  scanf("%d %d", &n, &m);
  cin >> x;
  for (int i = 0; i < n - 1; i++) {
    cin >> x1;
    width[i] = x1 - x;
    x = x1;
  }
  cin >> y;
  for (int i = 0; i < m - 1; i++) {
    cin >> y1;
    height[i] = y1 - y;
    y = y1;
  }
  solve();
  return 0;
}
