#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long bigmod(long long base, long long power) {
  if (power == 0) return 1;
  long long ret = bigmod(base, power / 2);
  ret = (ret * ret) % 1000000007;
  if (power & 1) ret = (ret * base) % 1000000007;
  return ret;
}
long long modInverse(long long n) {
  return (bigmod(n, 1000000007 - 2) % 1000000007);
}
int main() {
  int n;
  cin >> n;
  char a[1000];
  gets(a);
  int arr[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int l = strlen(a);
  int counter = 0;
  if (a[l - 1] == 'h') {
    for (int i = 0; i < 12; i++) {
      if (n <= arr[i]) counter++;
    }
  } else {
    if (n == 6 || n == 5)
      counter = 53;
    else
      counter = 52;
  }
  cout << counter << '\n';
  return 0;
}
