#include <bits/stdc++.h>
using namespace std;
int cntWeek[7];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  string str;
  string ty;
  int n;
  getline(cin, str);
  stringstream ss(str);
  ss >> n >> ty >> ty;
  for (int i = 0; i < 366; ++i) ++cntWeek[(i + 4) % 7];
  if (ty == "week")
    cout << cntWeek[n - 1];
  else {
    if (n <= 29)
      cout << 12;
    else if (n == 30)
      cout << 11;
    else
      cout << 7;
  }
}
