#include <bits/stdc++.h>
using namespace std;
int arr[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int n;
  scanf("%d", &n);
  string second;
  cin >> second;
  cin >> second;
  if (second == "week") {
    n--;
    n -= 4;
    while (n < 0) n += 7;
    n++;
    int sum = 0;
    for (int i = 0; i < 12; i++) sum += arr[i];
    int res = sum / 7;
    if (sum % 7 >= n) res++;
    cout << res;
  } else {
    int res = 0;
    for (int i = 0; i < 12; i++)
      if (arr[i] >= n) res++;
    cout << res;
  }
  return 0;
}
