#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline int read(){
int f=1,x=0;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')
f=-f;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';
ch=getchar();
}
return f*x;
}
inline void work(int k){
if(k<0){
putchar('-');
k=-k;
}
if(k>9)
work(k/10);
putchar(k%10+'0');
}
const int mod=998244353;
int n,m;
ll dp[505][250005],f[505][250005],sum[505][250005],sum1[505][250005];
pair<int,int> a[505],b[505];
int main(){
n=read();
m=read();
for(int i=1;i<=n;i++){
a[i].first=read();
a[i].second=read();
}
for(int i=1;i<=m;i++){
b[i].first=read();
b[i].second=read();
}
for(int i=0;i<=500;i++){
for(int j=0;j<=250000;j++){
dp[i][j]=f[i][j]=sum[i][j]=sum1[i][j]=1;
}
}
dp[0][0]=f[0][0]=1;
for(int i=1;i<=250000;i++){
}
for(int i=1;i<=n;i++){
for(int )
}
return 0;
}