#pragma GCC optimize("Ofast") #include using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) using ll=long long; const ll M=2e9+3; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,m,ans=0;cin>>n>>m; vector v(n),a(n),b(n),c(m),d(m); REP(i,n)cin>>v[i]; REP(i,n)cin>>a[i]>>b[i]; REP(j,m)cin>>c[j]>>d[j]; REP(k,4){ unordered_map mp; REP(i,n)REP(j,m)mp[ (a[i]-c[j])*M + (b[i]-d[j]) ]+=v[i]; for(auto [xy,va]:mp)ans=max(ans,va); REP(i,n)a[i]*=-1; if(k==1)REP(i,n)b[i]*=-1; } cout<