#include <bits/stdc++.h>
int a[100000];
using namespace std;
int b[10];
void solve() {
  memset(b, 0, sizeof(b));
  int tt = 5;
  for (int i = 1; i <= 366; i++) {
    b[tt]++;
    tt++;
    if (tt > 7) {
      tt = 1;
    }
  }
}
int main() {
  string s1, s2;
  int n;
  solve();
  while (cin >> n >> s1 >> s2) {
    if (s2 == "week") {
      printf("%d\n", b[n]);
    } else {
      if (n == 31)
        puts("7");
      else if (n == 30)
        puts("11");
      else if (n <= 29)
        puts("12");
    }
  }
  return 0;
}
