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