#include <bits/stdc++.h>
using namespace std;
char s[100];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int k;
  scanf("%d %s %s", &k, s, s);
  if (s[0] == 'w') {
    int x = 5;
    int cnt = 0;
    for (int i = 1; i <= 366; ++i) {
      if (x == k) cnt++;
      x++;
      if (x == 8) x = 1;
    }
    cout << cnt << endl;
  } else {
    if (k <= 29) cout << 12 << endl;
    if (k == 30) cout << 11 << endl;
    if (k == 31) cout << 7 << endl;
  }
  return 0;
}
