#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n,m;
  cin>>n>>m;
  vector<ll>X(n),Y(m);
  for(int i=0;i<n;i++)cin>>X[i];
  for(int i=0;i<m;i++)cin>>Y[i];
  ll sumx=0;
  for(int i=0;i<n;i++)sumx=(sumx+(i+1-(n-i))*X[i])%MOD;
  ll sumy=0;
  for(int i=0;i<m;i++)sumy=(sumy+(i+1-(m-i))*Y[i])%MOD;
  cout<<(sumx*sumy)%MOD<<endl;
  return 0;
}
