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