#include <bits/stdc++.h>
using namespace std;
vector<long long> A, Sum;
vector<pair<long long, long long> > Rec;
long long int a[4000002], b[200002], ans[200002];
int main() {
  int n, i;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  int Ans = 0;
  if (s2[0] == 'w') {
    if (n == 5 || n == 6)
      Ans = 53;
    else
      Ans = 52;
  } else {
    if (n == 30)
      Ans = 11;
    else if (n == 31)
      Ans = 7;
    else
      Ans = 12;
  }
  cout << Ans << endl;
  return 0;
}
