#include <bits/stdc++.h>
using namespace std;
char str[110], s[110], s1[110];
int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int num;
int main(void) {
  while (gets(str)) {
    sscanf(str, "%d", &num);
    int len = strlen(str);
    int i = 0, flag, j = 0;
    for (; i < len; i++)
      if (str[i] == 'w') {
        flag = 1;
        break;
      } else if (str[i] == 'm') {
        flag = 0;
        break;
      }
    if (flag) {
      if (num == 5 || num == 6)
        printf("53\n");
      else
        printf("52\n");
    } else {
      int cnt = 0;
      for (; j < 12; j++)
        if (month[j] >= num) cnt++;
      printf("%d\n", cnt);
    }
  }
  return 0;
}
