#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  getline(cin, a);
  int x;
  int candies = 0;
  if (a[1] == ' ')
    x = a[0] - '0';
  else
    x = (a[0] - '0') * 10 + (a[1] - '0');
  if (a[5] == 'm' || a[6] == 'm') {
    if (x == 31)
      candies = 7;
    else if (x == 30)
      candies = 11;
    else if (x == 0)
      candies = 0;
    else
      candies = 12;
  } else if (a[5] == 'w') {
    if (x == 5 || x == 6)
      candies = 53;
    else if (x == 0)
      candies = 0;
    else if (x == 1 || x == 2 || x == 3 || x == 4 || x == 7)
      candies = 52;
  }
  cout << candies << endl;
  return 0;
}
