#include <bits/stdc++.h>
#define inf 10000000000
#define N 1000000007
using namespace std;

long long n, m, x = 0, y = 0, ans;
long long minx = inf, miny = inf, maxx = 0, maxy = 0;

int main() {
  long long i;
  cin >> n >> m;
  cin >> minx;
  for(i = 1; i < n; ++i) {
    cin >> maxx;
    x += ((maxx - minx) * i) % N * (n - i) % N;
    x %= N;
    minx = maxx;
  }
  cin >> miny;
  for(i = 1; i < m; ++i) {
    cin >> maxy;
    y += ((maxy - miny) * i) % N * (m - i) % N;
    y %= N;
    miny = maxy;
  }
  cout << (x * y) % N << endl;
  return 0;
}
