#include<bits/stdc++.h>
const int maxn=5005;
int a[maxn][maxn];
using namespace std;
int main()
{
long long n,m,B,G;
cin>>n>>m>>B>>G;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
a[i][j]=0;
}
}
int ans=0;
for(int boy=0;boy<B;boy++)
{
int x,y;
cin>>x>>y;
for(int i=x;i<=y;i++)
{
for(int j=1;j<=m;j++)
{
if(a[i][j]==0)
{
a[i][j]=1;
ans++;
}
}
}
}
for(int girl=0;girl<G;girl++)
{
int x,y;
cin>>x>>y;
for(int i=x;i<=y;i++)
{
for(int j=1;j<=n;j++)
{
if(a[j][i]==0)
{
a[j][i]=1;
ans++;
}
}
}
}
cout<<ans;
return 0;
}
关注帮忙者