#include <bits/stdc++.h>
using namespace std;
long double pi = 4 * atanl(1.0);
long double eps = 1e-9;
string stringmin = "!";
string stringmax = "~";
int cnt = 0;
double ang1 = pi / 180;
pair<long double, long double> operator-(pair<long double, long double> p1,
                                         pair<long double, long double> p2) {
  return pair<long double, long double>(p1.first - p2.first,
                                        p1.second - p2.second);
}
pair<long double, long double> operator+(pair<long double, long double> p1,
                                         pair<long double, long double> p2) {
  return pair<long double, long double>(p1.first + p2.first,
                                        p1.second + p2.second);
}
long double operator*(pair<long double, long double> p1,
                      pair<long double, long double> p2) {
  return p1.first * p2.first + p1.second * p2.second;
}
pair<long double, long double> operator*(long double c,
                                         pair<long double, long double> p) {
  return pair<long double, long double>(c * p.first, c * p.second);
}
long double operator++(pair<long double, long double> p) {
  return sqrtl(p.first * p.first + p.second * p.second);
}
int main() {
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  string s;
  cin >> s >> s;
  if (s == "week") {
    if (n == 5 || n == 6)
      cout << 53;
    else
      cout << 52;
  } else {
    long long ans = 12;
    if (n > 29) ans--;
    if (n > 30) ans -= 4;
    cout << ans;
  }
  return 0;
}
