#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int x;
  string y, z;
  cin >> x >> y >> z;
  if (z[0] == 'w') {
    int fd = 5, ans = 0;
    for (int i = 1; i <= 366; ++i) {
      if (fd == x) ans++;
      fd++;
      if (fd == 8) fd = 1;
    }
    cout << ans << "\n";
  } else {
    if (x <= 29)
      cout << 12 << "\n";
    else if (x <= 30)
      cout << 11 << "\n";
    else
      cout << 7 << "\n";
  }
  return 0;
}
