#include <bits/stdc++.h>
using namespace std;
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
int main() {
  int a;
  string t;
  string s;
  cin >> a >> t >> s;
  if (s == "month") {
    if (a == 31) {
      cout << 7 << endl;
    }
    if (a == 30) {
      cout << 11 << endl;
    }
    if (a <= 29) {
      cout << 12 << endl;
    }
  }
  if (s == "week") {
    if (a == 5 || a == 6)
      cout << 53 << endl;
    else
      cout << 52 << endl;
  }
  return 0;
}
