#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n);
  vector<long long> y(m);
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> y[i];
  }
  long long sum1 = 0;
  for (long long i = 0; i < n - 1; i++) {
    sum1 *= 2;
    sum1 %= 1000000007;
    sum1 += (x[i + 1] - x[i]) * (i + 1);
    sum1 %= 1000000007;
  }
  long long sum2 = 0;
  for (long long i = 0; i < m - 1; i++) {
    sum2 *= 2;
    sum2 %= 1000000007;
    sum2 += (y[i + 1] - y[i]) * (i + 1);
    sum2 %= 1000000007;
  }
  cout << (sum1 * sum2) % 1000000007 << endl;
  return 0;
}
