#include <stdio.h>
#include <string.h>
int map[103][103]; //在外部定义自动初始化为0
int main()
{
int n;
scanf("%d",&n);
char input[10]; //黑、白、测试
int x,y,L; //边界界定值
int i,j;
int count; //黑色方块的计算器
while(n--)
{
scanf("%s",input);
scanf("%d%d%d",&x,&y,&L);
//printf("输出:%s %d %d %d\n\n",input,x,y,L);
// Paint a white square on the board,
// the square is defined by left-top grid (x, y)
// and right-bottom grid (x+L-1, y+L-1)
if(strcmp(input,"BLACK")==0)
{
for(i=x;i<=x+L-1;i++)
for(j=y;j<=y+L-1;j++)
map[i][j]=1;
}
if(strcmp(input,"WHITE")==0)
{
for(i=x;i<=x+L-1;i++)
for(j=y;j<=y+L-1;j++)
map[i][j]=0;
}
// Ask for the number of black grids
// in the square (x, y)- (x+L-1, y+L-1)
count=0;
if(strcmp(input,"TEST")==0)
{
for(i=x;i<=x+L-1;i++)
for(j=y;j<=y+L-1;j++)
{
if(map[i][j]==1)
count++;
}
printf("%d\n",count);
}
}
return 0;
}