#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  cin >> s;
  if (s[0] == 'm') {
    if (n == 31)
      cout << 7;
    else if (n == 30)
      cout << 11;
    else
      cout << 12;
  } else {
    if (n == 5 || n == 6)
      cout << 366 / 7 + 1;
    else
      cout << 366 / 7;
  }
}
