#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s >> s;
  if (s == "week")
    if (n == 5 || n == 6)
      cout << 53 << endl;
    else
      cout << 52 << endl;
  else
    switch (n) {
      case 31:
        cout << 7 << endl;
        break;
      case 30:
        cout << 11 << endl;
        break;
      default:
        cout << 12 << endl;
    }
  cin >> n;
  return 0;
}
