#include <bits/stdc++.h>
using namespace std;
const int day[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int a;
string s;
int main() {
  cin >> a >> s >> s;
  if (s == "month") {
    int cnt = 0;
    for (int i = 1; i <= 12; ++i) {
      if (a <= day[i]) ++cnt;
    }
    cout << cnt << endl;
  } else {
    if (a == 5 || a == 6) {
      printf("53\n");
    } else {
      printf("52\n");
    }
  }
  return 0;
}
