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