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