#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const int M = 1e9 + 7;
long long x[N];
long long y[N];
long long dp[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  int i;
  dp[1] = ((x[1] - x[0]) * (y[1] - y[0]));
  for (i = 2; i < max(n, m); i++) {
    long long x1 = x[i], y1 = y[i], x2 = x[i - 1], y2 = y[i - 1];
    if (i >= n) {
      x1 = x[n - 1];
      x2 = x[n - 2];
    }
    if (i >= m) {
      y1 = y[m - 1];
      y2 = y[m - 2];
    }
    long long z = (4 * (x1 - x[0]) * (y1 - y[0])) % M;
    long long o = ((x2 - x[0]) * (y2 - y[0])) % M;
    dp[i] = (((dp[i - 1] + z) % M) - o) % M;
  }
  cout << (dp[max(n, m) - 1] + M) % M;
}
