#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s >> s;
  if (s == "week") {
    if (n == 7 || n < 5) {
      cout << "52\n";
      return 0;
    }
    cout << "53\n";
    return 0;
  }
  int ans = 0;
  int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  for (int i = 0; i < 12; ++i) {
    if (month[i] >= n) ++ans;
  }
  cout << ans << endl;
  return 0;
}
