#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("jxfgx.in");
ofstream fout("jxfgx.out");
int l[2001][2001]={0};
int main()
{
int m,n,k,sum=0;
int a,x1,x2,y1,y2;
fin>>n>>m>>k;
for (int g=1;g<=k;g++)
{
fin>>a>>x1>>y1>>x2>>y2;
if (a==1)
{
for (int i=x1;i<=x2;i++)
for (int j=y1;j<=y2;j++)
{
l[i][j]++;
if (l[i][j]==1) sum++;
}
}
else
if (a==2)
{
for (int i=x1;i<=x2;i++)
for (int j=y1;j<=y2;j++)
{
l[i][j]--;
if (l[i][j]==0) sum--;
}
}
fout<<sum<<endl;
}
fin.close();
fout.close();
return 0;
}