#include <iostream>
using namespace std;
struct ZJ{
ZJ* node[62];
bool IsAC; // 到底有沒AC
bool IsNowAC; // 最後一筆是否AC
ZJ(){
memset(node, 0, 62*sizeof(ZJ*));
IsAC=false;
IsNowAC=false;
}
} *root=new ZJ;
inline short CharInd(char Ch);
inline short CharInd(char Ch){
if(Ch<65) return Ch-48;
if(Ch<97) return Ch-55;
return Ch-61;
}
int main(){
short Ask, AC=0, InstantAC=0, GetRun, i, x;
char Name[31], Ch;
bool Status;
scanf("%d", &Ask);
getchar();
while(--Ask>=0){
memset(Name, 0, 31*sizeof(char));
GetRun=0;
while(Ch=getchar()){
if(Ch==' ') break;
Name[GetRun++]=Ch;
}
Status=!(getchar()-65); // 'A' is enough to stand for "AC"
while(getchar()!='\n');
ZJ* p=root;
for(i=0; Name[i]; ++i){
x=CharInd(Name[i]);
if(p->node[x]==0){
p->node[x]=new ZJ;
p=p->node[x];
}
else p=p->node[x];
}
// Calculate InstantAC and AC
if(Status){
if(!(p->IsNowAC)){
++InstantAC;
p->IsNowAC=true;
}
if(!(p->IsAC)){
++AC;
p->IsAC=true;
}
}
else if(p->IsNowAC){
p->IsNowAC=false;
--InstantAC;
}
}
printf("%d%%", (int)InstantAC*100/(int)AC);
// system("pause");
return 0;
}