#include <bits/stdc++.h>
const signed long long int MAX_SLLI = 0x7FFFFFFFFFFFFFFF;
const signed long long int MIN_SLLI = 0x8000000000000000;
const unsigned long long int MAX_ULLI = 0xFFFFFFFFFFFFFFFF;
const unsigned long long int MIN_ULLI = 0x0000000000000000;
const unsigned long long int MOD = 1e+9 + 7;
unsigned long long int power2_mod(unsigned long long int n) {
  if (n == 0) return 1;
  if (n == 1) return 2;
  unsigned long long int x = power2_mod(n >> 1);
  x = (x * x) % MOD;
  if ((n & 1) == 1) {
    x = (x << 1) % MOD;
  }
  return x;
}
int main() {
  unsigned N, M;
  std::cin >> N >> M;
  std::vector<signed long long int> x(N), y(M);
  for (unsigned n = 0; n < N; ++n) std::cin >> x[n];
  for (unsigned m = 0; m < M; ++m) std::cin >> y[m];
  unsigned long long int X = (x[N - 1] - x[0]) % MOD;
  unsigned long long int Y = (y[M - 1] - y[0]) % MOD;
  unsigned long long int P = (X * power2_mod(N - 2)) % MOD;
  unsigned long long int Q = (Y * power2_mod(M - 2)) % MOD;
  unsigned long long int S = (P * Q) % MOD;
  std::cout << S << std::endl;
  return 0;
}
