#include<cstdio>
#include<cstring>
int rec[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
int t;
char tem[10],time[20];
while(~scanf("%d",&t))
{
scanf("%s%s",tem,time);
if(time[0]=='w')
{
if(t==5||t==6)
printf("53\n");
else
printf("52\n");
}
else
{
if(t==31)
printf("7\n");
else if(t==30)
printf("11\n");
else
printf("12\n");
}
}
return 0;
}