#include <bits/stdc++.h>
using namespace std;
string s;
int x, sol;
int main() {
  std::ios_base::sync_with_stdio(false);
  string s1;
  cin >> x;
  cin >> s1;
  cin >> s1;
  int ok = 0;
  if (s1[0] == 'w') ok = 1;
  if (ok == 1) {
    if (x == 5 || x == 6)
      sol = 53;
    else
      sol = 52;
  } else {
    if (x <= 29)
      sol = 12;
    else {
      if (x == 30)
        sol = 11;
      else {
        if (x == 31) sol = 7;
      }
    }
  }
  cout << sol << "\n";
  return 0;
}
