#include <bits/stdc++.h>
using namespace std;
int ta[20] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  char s[100];
  int a;
  cin >> a >> s >> s;
  int b = 5;
  int ans = 0;
  if (s[0] == 'w') {
    for (int i = 0; i < 366; i++) {
      if (b == a) {
        ans++;
      }
      b++;
      if (b == 8) b = 1;
    }
  } else {
    for (int i = 1; i <= 12; i++) {
      if (a <= ta[i]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
