#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int x;
  string of, s;
  cin >> x >> of >> s;
  if (s == "week") {
    if (x <= 4 || x == 7)
      cout << 52 << endl;
    else
      cout << 53 << endl;
  } else {
    if (x <= 29)
      cout << 12 << endl;
    else if (x <= 30)
      cout << 11 << endl;
    else
      cout << 7 << endl;
  }
}
