#include<bits/stdc++.h>
using namespace std;
int x[5145141],y[5145141],n,m,q;
int zz(int rt)
{
return rt<<1;
}
int yz(int rt)
{
return rt<<1|1;
}
void st(int *a,int rt)
{
a[rt]=a[zz(rt)]+a[yz(rt)];
}
void xg(int *a,int k,int l,int r,int rt)
{
if(l==r)
{
a[rt]^=1;
return ;
}
int mi((l+r)/2);
if(k<=mi)
xg(a,k,l,mi,zz(rt));
else
xg(a,k,mi+1,r,yz(rt));
st(a,rt);
}
int cx(int *a,int L,int R,int l,int r,int rt)
{
if(L<=l&&r<=R)
{
return a[rt];
}
int mi((l+r)/2),ans=0;
if(L<=mi)
ans+=cx(a,L,R,l,mi,zz(rt));
if(mi<R)
ans+=cx(a,L,R,mi+1,r,yz(rt));
return ans;
}
int main()
{
cin>>n>>m>>q;
while(q)
{
q--;
int c,xx,yy,xxx,yyy;
cin>>c;
if(c==1)
{
cin>>xx>>yy;
xg(x,xx,1,n,1);
xg(y,yy,1,m,1);
}
else
{
cin>>xx>>yy>>xxx>>yyy;
long long x0=cx(x,xx,xxx,1,n,1),y0=cx(y,yy,yyy,1,m,1);
cout<<x0*(long long)(xxx-xx+1)+y0*(long long)(yyy-yy+1)-((x0*y0)*2)<<endl;
}
}
return 0;
}