#include <bits/stdc++.h>
using namespace std;
void solve() {
  int x, i, j;
  string a[2][2];
  string b = "week";
  string c = "month";
  string s;
  cin >> x;
  for (i = 0; i < 1; i++) {
    for (j = 0; j < 2; j++) cin >> a[i][j];
  }
  s = a[0][1];
  if (s == b) {
    if (x == 5 || x == 6) {
      cout << "53" << endl;
      return;
    }
    cout << "52" << endl;
    return;
  } else {
    if (x >= 1 && x <= 29) {
      cout << "12" << endl;
      return;
    }
    if (x <= 30) {
      cout << "11" << endl;
      return;
    }
    cout << "7" << endl;
    return;
  }
}
int main() { solve(); }
