#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  string s;
  scanf("%d", &x);
  getline(cin, s);
  if (s.find("week") < s.size()) {
    if (x == 5 || x == 6)
      cout << 53;
    else
      cout << 52;
  } else {
    if (x == 31)
      cout << 7;
    else if (x == 30)
      cout << 11;
    else
      cout << 12;
  }
  return 0;
}
