#include <bits/stdc++.h>
using namespace std;
int main() {
  long i, n, m;
  scanf("%d %d", &n, &m);
  long x, y;
  long sumx = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    sumx += x * (i * 2 - (n - 1));
    cout << sumx << endl;
  }
  sumx %= 1000000007;
  long sumy = 0;
  for (i = 0; i < m; i++) {
    scanf("%d", &y);
    sumy += y * (i * 2 - (m - 1));
    cout << sumy << endl;
  }
  sumy %= 1000000007;
  printf("%d\n", sumx * sumy % 1000000007);
  return 0;
}
