#include <bits/stdc++.h>
int main() {
  std::string linia;
  unsigned int number = 0;
  unsigned int howMany = 0;
  std::cin >> number >> linia >> linia;
  unsigned int dlugosc = linia.length() - 1;
  if (linia[dlugosc] == 'k') {
    howMany = 366 / 7;
    unsigned int x = 366 % 7;
    if (number <= x + 4 && number > 4) howMany++;
  } else {
    if (number < 30)
      howMany = 12;
    else if (number == 30)
      howMany = 11;
    else
      howMany = 7;
  }
  std::cout << howMany;
  return 0;
}
