#include <bits/stdc++.h>
using namespace std;
void File() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int x;
  string s[2];
  cin >> x >> s[0] >> s[1];
  if (s[1] == "week") {
    if (x == 5 || x == 6)
      cout << 53;
    else
      cout << 52;
  } else {
    if (x <= 29)
      cout << 12;
    else if (x <= 30 && x > 29)
      cout << 11;
    else if (x <= 31 && x > 30)
      cout << 7;
  }
}
