#include <bits/stdc++.h>
using namespace std;

int main() {
	long long n,m,i,j,k,c,cur,ans1=0,ans2=0,mod=1000000007;
	cin >> n >> m;
	cur=0;
	for(i=1; i<=n; i++){
		cin >> c;
		cur=(cur+c)%mod;
		ans1=(ans1+c*i-cur)%mod;
	}
	cur=0;
	for(i=1; i<=m; i++){
		cin >> c;
		cur=(cur+c)%mod;
		ans2=(ans2+c*i-cur)%mod;
	}
	c=(ans1*ans2)%mod;
	if(c<0) c+=mod;
	cout << c;
	return 0;
}