#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {
	int n, m; cin >> n >> m;
	ll x[114514];
	for (int i = 0; i < n; i++)cin >> x[i];
	sort(x, x + n);
	ll xs = 0;
	for (int i = 0; i < n; i++) {
		xs += x[i] * ((n - i - 1) - i);
		xs %= 1000000007;
	}
	ll y[114514];
	for (int i = 0; i < m; i++)cin >> y[i];
	sort(y, y + m);
	ll ys = 0;
	for (int i = 0; i < m; i++) {
		ys += y[i] * ((m - i - 1) - i);
		ys %= 1000000007;
	}
	cout << xs*ys % 1000000007;
	return 0;
}