#include<bits/stdc++.h>
using namespace std;
bool b[40][60]={true};
int main()
{
int r,c,a,n,l=0,k;
char p;
cin>>r>>c>>n; a=r*c;
for(int i=0;i<40;i++) for(int j=0;j<60;j++) b[i][j]=true;
while(n--){
cin>>p>>k;
bool h=false;
int st=0;
for(int i=0;i<c;i++) if(!b[k][i]) st=i;
for(int i=st;i<c;i++){
if(p=='A'&&b[k][i]&&b[k+1][i]&&b[k+2][i]&&b[k+3][i]&&(k+4)<=r){
b[k][i]=b[k+1][i]=b[k+2][i]=b[k+3][i]=false;
a-=4;
h=true; break;
}
if(p=='B'&&b[k][i]&&b[k][i+1]&&b[k][i+2]&&(i+3)<=c){
b[k][i]=b[k][i+1]=b[k][i+2]=false;
a-=3;
h=true; break;
}
if(p=='C'&&b[k][i]&&b[k][i+1]&&b[k+1][i]&&b[k+1][i+1]&&(k+2)<=r&&(i+2)<=c){
b[k][i]=b[k][i+1]=b[k+1][i]=b[k+1][i+1]=false;
a-=4;
h=true; break;
}
if(p=='D'&&b[k][i]&&b[k][i+1]&&b[k][i+2]&&b[k-1][i+2]&&(i+3)<=c&&k>=1){
b[k][i]=b[k][i+1]=b[k][i+2]=b[k-1][i+2]=false;
a-=4;
h=true; break;
}
if(p=='E'&&b[k][i]&&b[k+1][i]&&b[k+2][i]&&b[k+1][i-1]&&b[k+2][i-1]&&(k+3)<=r&&i>=1){
b[k][i]=b[k+1][i]=b[k+2][i]=b[k+1][i-1]=b[k+2][i-1]=false;
a-=5;
h=true; break;
}
} if(!h) l++;
} cout<<a<<' '<<l<<'\n';
}