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