#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, m;
int a[maxn], b[maxn];
char s1[maxn], s2[maxn];
bool ok = 0;
int main() {
  int t, ret = 0;
  ;
  scanf("%d %s %s", &t, s1, s2);
  if (s2[0] == 'w') {
    if (t == 5 || t == 6) {
      cout << 53 << endl;
      return 0;
    } else {
      cout << 52 << endl;
      return 0;
    }
  } else if (s2[0] == 'm') {
    if (t == 30) {
      cout << 11 << endl;
      return 0;
    } else if (t == 31) {
      cout << 7 << endl;
      return 0;
    } else {
      cout << 12 << endl;
      return 0;
    }
  }
  return 0;
}
