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