#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
string s1, s2;
int x;
void work1() {
  int p = 5, ans = 0;
  for (int i = 1; i <= 366; i++) {
    if (p == x) ans++;
    p++;
    p = p % 7;
    if (p == 0) p = 7;
  }
  cout << ans << endl;
}
void work2() {
  int days[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int ans = 0;
  for (int i = 1; i <= 12; i++) {
    if (x <= days[i]) ans++;
  }
  cout << ans << endl;
}
int main() {
  cin >> x >> s1 >> s2;
  if (s2.compare("week") == 0)
    work1();
  else
    work2();
}
