#include <bits/stdc++.h>
int month[32], week[8] = {0, 52, 52, 52, 52, 53, 53, 52};
char s[3], str[10];
int main() {
  int i, n;
  for (i = 1; i < 30; i++) month[i] = 12;
  month[30] = 11;
  month[31] = 7;
  scanf("%d%s%s", &n, s, str);
  if (str[0] == 'm')
    printf("%d\n", month[n]);
  else
    printf("%d\n", week[n]);
}
