#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000001;
const long long INF = 1e16;
int main() {
  long long n, m, i, j;
  cin >> n >> m;
  vector<long long> x(n), y(m);
  for (i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (i = 0; i < m; i++) {
    cin >> y[i];
  }
  long long M = max(n, m);
  vector<long long> kai(M, 0);
  for (i = 0; i < M; i++) {
    for (j = 0; j < i + 1; j++) {
      kai[j] = (kai[j] + j) % 1000000007;
    }
  }
  vector<int> x2(n), y2(m);
  x2[0] = y2[0] = 0;
  for (i = 1; i < n; i++) {
    x2[i] = (x[i] - x[i - 1]) % 1000000007;
  }
  for (i = 1; i < m; i++) {
    y2[i] = (y[i] - y[i - 1]) % 1000000007;
  }
  long long s = 0;
  for (i = 1; i < n; i++) {
    for (j = 1; j < m; j++) {
      s = s + ((x2[i] * y2[j]) % 1000000007 * (kai[i] * kai[j]) % 1000000007) %
                  1000000007;
    }
  }
  s %= 1000000007;
  cout << s << endl;
}
