#include<bits/stdc++.h>
#include<sstream>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define loop(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revloop(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define stloop(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define s second
#define ll long long int
#define vi vector<int>
#define rs resize
int main()
{  std::ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   ll n,m,i,a1=0,a2=0;
   cin>>n>>m;
   ll a[n],b[n],cum1[n],cum2[n];
   loop(i,0,n)
   {
    cin>>a[i];
    if(i==0)
     cum1[i]=a[i];
    else
     cum1[i]=cum1[i-1]+a[i];
   }
   loop(i,0,m)
   {
    cin>>b[i];
    if(i==0)
     cum2[i]=b[i];
    else
     cum2[i]=cum2[i-1]+b[i];
   }
   loop(i,1,n)
    a1=(a1+i*1LL*a[i]-cum1[i-1]+mod)%mod;
   loop(i,1,m)
    a2=(a2+i*1LL*b[i]-cum2[i-1]+mod)%mod;
   a1=(a1*1LL*a2)%mod;
   cout<<a1;
   return 0;
}
