#include<cstdio>
#include<cstring>
int main()
{
int n;
char a[11];
while(~scanf("%d",&n))
{
gets(a);
if(a[4]=='w')
{
if(n==5||n==6)
printf("53\n");
else
printf("52\n");
}
else
{
if(n==31)
printf("7\n");
else if(n==30)
printf("11\n");
else
printf("12\n");
}
}
return 0;
}