#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
const long long MOD = 1e9 + 7;
long long n, m;
long long x[100010], y[100010];
long long CalcXSum() {
  long long ret = 0;
  for (long long i = 0; i < n - 1; i++) {
    long long a_i = (i + 1) * (n - i - 1) % MOD;
    ret = (ret + a_i * (x[i + 1] - x[i]) % MOD) % MOD;
  }
  return ret;
}
int main() {
  cin >> n >> 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 xSum = CalcXSum();
  cout << xSum << endl;
  long long ans = 0;
  for (long long i = 0; i < m - 1; i++) {
    long long b_i = (i + 1) * (m - i - 1) % MOD;
    ans = (ans + b_i * (y[i + 1] - y[i]) % MOD * xSum % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
