#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  int n, m;
  long long x[100010], y[100010];
  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 sumn = 0;
  for (int i = 0; i < n; i++) {
    sumn = sumn + (i * x[i]);
    sumn = sumn - ((n - i - 1) * x[i]);
  }
  cout << sumn << endl;
  sumn %= MOD;
  long long summ = 0;
  for (int i = 0; i < m; i++) {
    summ = summ + (i * y[i]);
    summ = summ - ((m - i - 1) * y[i]);
  }
  cout << summ << endl;
  summ %= MOD;
  cout << (sumn * summ) % MOD << endl;
}
