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