#include <bits/stdc++.h>
using namespace std;
long long V[200010];
signed main(void) {
  V[0] = 1;
  for (long long i = 0; i < 200009; i++) {
    V[i + 1] = V[i] * 2 % 1000000007;
  }
  long long n, m;
  cin >> n >> m;
  long long x0, x1, y0, y1;
  cin >> x0;
  for (long long i = 0; i < n - 1; i++) cin >> x1;
  cin >> y0;
  for (long long i = 0; i < m - 1; i++) cin >> y1;
  long long x = (x1 - x0) % 1000000007, y = (y1 - y0) % 1000000007;
  long long y2 = y / 32000, y3 = y % 32000;
  long long sum =
      ((x * y2 % 1000000007) * 32000 % 1000000007 + y3 * x % 1000000007) %
      1000000007;
  cout << (sum * (V[n + m - 4] / 32000) % 1000000007 * 32000 % 1000000007 +
           sum * (V[n + m - 4] % 32000) % 1000000007) %
              1000000007;
}
