#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;

const ll mod = 1000000007;

ll scale(int n) {
	ll p;
	ll ret = 0;
	for (int i = 1; i <= n; i++) {
		cin >> p;
		ret += p * (2 * i - 1 - n);
		ret %= mod;
	}
	return ret;
}

int main() {
	int n,m;
	ll X, Y;
	cin >> n >> m;
	X = scale(n);
	Y = scale(m);

	cout << X * Y%mod << endl;

	return 0;
}