#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &s, const pair<A, B> &p) {
  return s << "(" << p.first << "," << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &c) {
  s << "[ ";
  for (auto it : c) s << it << " ";
  s << "]";
  return s;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int x;
  string a, b;
  cin >> x >> a >> b;
  int ans = 0;
  if (b == "week") {
    if (x == 5 || x == 6)
      ans = 53;
    else
      ans = 52;
  } else {
    if (x <= 29)
      ans = 12;
    else if (x == 30)
      ans = 11;
    else
      ans = 7;
  }
  cout << ans << endl;
  return 0;
}
