#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  string s1, s2;
  cin >> n >> s1 >> s2;
  if (s2 == "week") {
    if (n == 5 || n == 6) {
      cout << "53" << endl;
    } else {
      cout << "52" << endl;
    }
  } else {
    if (n <= 29) {
      cout << "12" << endl;
    } else if (n == 30) {
      cout << "11" << endl;
    } else if (n == 31) {
      cout << "7" << endl;
    }
  }
}
