#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
long long N, M;
long long x[100010], y[100010];
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> x[i];
  for (int i = 0; i < M; i++) cin >> y[i];
  long long S = (x[N - 1] - x[0]) * (y[M - 1] - y[0]);
  S %= 1000000000 + 7;
  long long tmp = (N - 1) * (M - 1);
  tmp %= 1000000000 + 7;
  long long ans = tmp * S;
  ans %= 1000000000 + 7;
  cout << ans << endl;
}
