#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;

signed main(){
    int n,m,xx=0,yy=0; cin>>n>>m;
    vector<int> x(n),y(m);
    rep(i,n) cin>>x.at(i);
    rep(i,m) cin>>y.at(i);
    rep(i,n-1){
        xx+=(x.at(i+1)-x.at(i))*(i+1)*(n-i-1);
    }
    rep(i,m-1){
        yy+=(y.at(i+1)-y.at(i))*(i+1)*(m-i-1);
    }
    cout<<((xx%mod)*(yy%mod))%mod<<endl;
}