#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a;
  cin >> b;
  cin >> c;
  int flag = 0;
  int sum = 0;
  int wm = -1;
  for (int i = 0; i < (int)a.size(); i++) sum = sum * 10 + (a[i] - '0');
  if (c[0] == 'w')
    wm = 1;
  else
    wm = 0;
  int ans = 0;
  if (wm == 1) {
    if (sum == 6 || sum == 5)
      ans = 53;
    else
      ans = 52;
  } else {
    if (sum < 30) ans = 12;
    if (sum == 30) ans = 11;
    if (sum == 31) ans = 7;
  }
  cout << ans << "\n";
  return 0;
}
