#include <bits/stdc++.h>
using namespace std;
void printvictor(vector<long long> v) {
  for (long long i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
template <class T>
string toStr(const T &x) {
  stringstream s;
  s << x;
  return s.str();
}
template <class T>
int toInt(const T &x) {
  stringstream s;
  s << x;
  int r;
  s >> r;
  return r;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
bool isprime(long long n) {
  if (n == 2) return true;
  if (n < 2 || n % 2 == 0) return false;
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  long long n;
  string s, temp;
  cin >> n >> temp >> s;
  if (s == "week") {
    if (n == 5 || n == 6)
      cout << 53 << endl;
    else
      cout << 52 << endl;
  } else {
    if (n == 30)
      cout << 11 << endl;
    else if (n == 31)
      cout << 7 << endl;
    else
      cout << 12 << endl;
  }
  return 0;
}
