#include <bits/stdc++.h>
using namespace std;
int x, s, d[15] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char t[10], a[10];
int main() {
  int i;
  cin >> x;
  cin >> t >> a;
  if (a[0] == 'm') {
    for (i = 1; i <= 12; i++) {
      if (x <= d[i]) s++;
    }
  } else {
    s = 366 / 7;
    if (x == 5 || x == 6) s++;
  }
  cout << s << endl;
  return 0;
}
