#include <bits/stdc++.h>
using namespace std;
int main() {
  int i;
  string s, s1;
  cin >> i;
  cin >> s >> s1;
  if (s1[0] == 'w') {
    if (i == 5 || i == 6)
      cout << 53;
    else
      cout << 52;
  } else {
    if (i == 30)
      cout << 11;
    else if (i == 31)
      cout << 7;
    else
      cout << 12;
  }
  return 0;
}
