#include <bits/stdc++.h>
bool divIsPrime(unsigned long long num) {
  if (num == 2 || num == 3 || num % 2 == 0 || num % 3 == 0) return true;
  if (num < 2) return false;
  for (int i = 5; i <= sqrt(num); i += 6) {
    if (num % i == 0 || num % (i + 2) == 0) return false;
  }
  return true;
}
using namespace std;
int main() {
  int a;
  string s;
  cin >> a >> s >> s;
  if (s == "week")
    cout << 52 + (a == 5 || a == 6) << "\n";
  else
    cout << (a > 29 ? (a > 30 ? 7 : 11) : 12) << "\n";
  return 0;
}
