#include <bits/stdc++.h>
using namespace std;
string a, b, c;
int d, i;
int main() {
  cin >> a >> b >> c;
  for (i = 0; i < a.size(); i++) {
    if (c[i] == 'm') {
      if (a[1] <= '9' && '0' <= a[1])
        d = (a[0] - '0') * 10 + a[1] - '0';
      else
        d = a[0] - '0';
      if (d <= 29) {
        cout << 12 << endl;
        return 0;
      }
      if (d == 30) {
        cout << 11 << endl;
        return 0;
      }
      if (d == 31) {
        cout << 7 << endl;
        return 0;
      }
    }
    if (c[i] == 'w') {
      d = a[0] - '0';
      if (d <= 4 || d == 7) {
        cout << 52 << endl;
        return 0;
      }
      if (d == 5 || d == 6) {
        cout << 53 << endl;
        return 0;
      }
    }
  }
  return 0;
}
