#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define mod 1000000007
int n,m;
int a[114514],b[114514],c,d;
signed main(){
	cin>>n>>m;
	rep(i,n){
		cin>>a[i];
		if(i)c+=(a[i]-a[i-1])*i*(n-i);
		c%=mod;
	}
	rep(i,m){
		cin>>b[i];
		if(i)d+=(b[i]-b[i-1])*i*(m-i);
		d%=mod;
	}
	cout<<c*d%mod<<endl;
	return 0;
}
