#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s, s1 = " of week", s2 = " of month";
  cin >> n;
  getline(cin, s);
  if ((n == 1 || n == 2 || n == 3 || n == 4 || n == 7) && (s == s1)) {
    cout << 52 << endl;
  } else if ((n == 5 || n == 6) && (s == s1)) {
    cout << 53 << endl;
  } else if ((n == 31) && (s == s2)) {
    cout << 7 << endl;
  } else if ((n == 30) && (s == s2)) {
    cout << 11 << endl;
  } else if ((n <= 29) && (s == s2)) {
    cout << 12 << endl;
  }
  return 0;
}
