#include <bits/stdc++.h>
using namespace std;
int main() {
  char s1[20], s2[20], t;
  scanf("%s", s1);
  scanf(" %s", s2);
  scanf(" %c", &t);
  int i = 0, day = 0, ans = 0;
  while (i < strlen(s1)) {
    day = day * 10 + s1[i] - '0';
    i++;
  }
  if (t == 'w') {
    ans = 52;
    if (day == 5 || day == 6) ans++;
  } else {
    if (day <= 29)
      ans = 12;
    else if (day == 30)
      ans = 11;
    else
      ans = 7;
  }
  cout << ans << "\n";
  return 0;
}
