#include <bits/stdc++.h>
using namespace std;
int a;
char s[12], t[12];
int main() {
  scanf("%d %s %s", &a, s, t);
  if (!strcmp(t, "week")) {
    if (a == 5 || a == 6)
      printf("53\n");
    else
      printf("52\n");
  } else {
    if (a <= 29)
      printf("12\n");
    else if (a == 30)
      printf("11\n");
    else
      printf("7\n");
  }
  return 0;
}
