#include <bits/stdc++.h>
using namespace std;
const int dwek[] = {0, 4, 5, 6, 7, 1, 2, 3};
const int dmon[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int d;
string s;
int main() {
  cin >> d >> s >> s;
  int ans(0);
  if (s[0] == 'w') {
    int dt = dwek[d];
    while (dt <= 366) {
      ans++;
      dt += 7;
    }
  } else {
    for (int i = 1; i <= 12; i++) {
      if (dmon[i] >= d) ans++;
    }
  }
  cout << ans;
}
