#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define eb emplace_back
#define ef emplace_front
#define pb push_back
#define rep(x,n) for(ll i=x;i<n;++i)
#define mp make_pair
#define fi first
#define se second
#define ii pair<ll,ll>
#define cin(a,n) ;rep(0,n){ll k;cin>>k;a.eb(k);}
#define endl '\n'
#define s(a) sort(a.begin(),a.end())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define reverse(s) reverse(s.begin(),s.end())
#define ld long double
#define vs vector<string>
#define inf INT_MAX
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int d[100];
signed main() {
	fastio;
	int n;
	string s;
	cin >> n >> s >> s;
	if (s == "week") {
		if (n >= 5 && n != 7) cout << 53;
		else cout << 52;
	}
	else {
		if (n <= 29) cout << 12;
		else if (n == 31) cout << 7;
		else cout << 11;
	}
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int MXN = 1e5 + 1;

ll n;
string a, b;

int main()
{
    cin >> n >> a >> b;
    if(b == "week")
    {
        if(n == 1)
        {
            cout << 52;
        }
        if(n == 2)
        {
            cout << 52;
        }
        if(n == 3)
        {
            cout << 52;
        }
        if(n == 4)
        {
            cout << 52;
        }
        if(n == 5)
        {
            cout << 53;
        }
        if(n == 6)
        {
            cout << 53;
        }
        if(n == 7)
        {
            cout << 52;
        }
    }
    if(b == "month"){
        if(n <= 29)
        {
            cout << 12;
        }
        if(n == 30){
            cout << 11;
        }
        if(n == 31){
            cout << 7;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    string s1,s2;
    cin>>x>>s1>>s2;
    if(s2=="month")
    {
        if(x<=29)
            cout<<"12";
        else if(x==31)
            cout<<"7";
        else
            cout<<"11";
    }
    else
    {
        if(x==6||x==5)
            cout<<"53";
        else
            cout<<"52";
    }
}

#include<iostream>
using namespace std;
int n;
string s;
main()
{
cin>>n>>s;
cin>>s;
if(s=="week") {
if(n==6 || n==5 )
cout<<53<<endl;
else
cout<<52<<endl;}
else
if(n==31)
cout<<7<<endl;
else
if(n==30)
cout<<11<<endl;
else
cout<<12<<endl;
}

#pragma warning(disable:4996)

#include <iostream>
#include <unordered_map>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>

#define forn(i, n) for (int i = 0; (i) < (n); i++)

using namespace std;

long long cntPair(long long v) {
	return v * (v - 1) / 2LL;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	int n;
	string a, b;
	cin >> n >> a >> b;
	if (b == "month") {
		if (n == 31) {
			cout << 7 << endl;
			return 0;
		}
		if (n == 30) {
			cout << 11 << endl;
			return 0;
		}
		cout << 12 << endl;
	}
	else {
		if (n >= 5 && n <= 6) {
			cout << 53 << endl;
		}
		else {
			cout << 52 << endl;
		}
	}
}

#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <sstream>
#include <assert.h>
#include <fstream>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstdio>
#include <complex>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <set>
#include <map>

using namespace std;

const int day[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int x;
string s;
int ans;

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	cin >> x >> s >> s;
	int d = 5;
	for (int i = 0; i < 12; ++i)
	{
		for (int j = 1; j <= day[i]; ++j)
		{
			if (s == "week" && d == x)
				ans++;
			if (s == "month" && j == x)
				ans++;
			d++;
			if (d > 7)
				d = 1;
		}
	}
	cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main ()
{
    int num;
    char s[15];
    scanf (" %d", &num);
    scanf (" %s", s);
    scanf (" %s", s);
    if (strcmp (s, "week") == 0) {
        if(num==6 || num==5) printf ("53\n");
        else printf ("52\n");
    }
    if (strcmp (s, "month") == 0) {
        if (num <= 29) printf ("12\n");
        else if (num == 30) printf ("11\n");
        else if (num== 31) printf ("7\n");
    }

    return 0;
}

# include <iostream>
# include <algorithm>
# include <string>
# include <cmath>
# include <utility>
# include <set>

# define ll long long
# define F first
# define S second
# define mp make_pair

using namespace std;

const int MAXN = (int) 1e8 + 1;

int main()
{
    string s;
    getline (cin,s);
    if (s[6] == 'm' || s[5] == 'm')
    {
        if (s[0] == '2' && s[1] == '9' )
        {
            cout<<"12";
            return 0;
        }
        if (s[0] == '3' && s[1] == '0' )
        {
            cout<<"11";
            return 0;
        }
        if (s[0] == '3' && s[1] == '1' )
        {
            cout<<"7";
            return 0;
        }
        else cout<<"12";
        return 0;
    }
    else
    {
        if (s[0] == '5' || s[0] == '6')
        {
            cout<<"53";
            return 0;
        }
        else cout<<"52";
    return 0;
    }
}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<ll>
#define pll pair<ll, ll>
#define MOD 1000000007
#define MAX_TIME 1e9
#define nl "\n"
#define sp " "
#define gcd __gcd
#define pf printf
#define sf scanf
#define se(a) a.begin(), a.end()
#define fill(a,n) for(int i = 0; i < n; i++) cin>>a[i];

int main()
{
    string s;
    getline(cin,s);
    if(s[s.size()-1] == 'k'){
        int x = stoi(s.substr(0,2));
        if(x >= 5 && x <= 6)cout<<53;
        else cout<<52;
    }
    else{
        int x = stoi(s.substr(0,2));
        if(x <= 29)cout<<12<<nl;
        if(x == 30)cout<<11<<nl;
        if(x == 31)cout<<7<<nl;
        // else cout<<11<<nl;
    }
}

#include<iostream>
#include<string>

using namespace std;

int main(int argc,char* argv[])
{
    string a,b,c;
    cin >> a >> b >> c;
    if (c == "week") {
        int m = stoi(a);
        if (m < 5 || m == 7)
            cout << 52;
        else
            cout << 53;
    }
    else {
        int n = stoi(a);
        if (n == 30)
            cout << 11;
        else if (n == 31)
            cout << 7;
        else
            cout << 12;
    }
}

//

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>

using namespace std;

string str;
int result = 0;
int size_x;

int main()
{
	int ii;
	int current = 5;

	cin >> size_x;

	cin.ignore();

	getline(cin, str);

	if (str[3] == 'w')
	{
		for (ii = 0; ii < 366; ii++)
		{
			if (size_x == current)
				result++;

			current++;

			if (current > 7)
				current = 1;
		}
	}
	else
	{
		result = 12;

		if (size_x == 30)
			result = 11;
		else if (size_x == 31)
			result = 7;
	}

	cout << result << endl;

}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

int main() {

    string s , s1 = "";
    getline (cin , s);

    if(s[s.size()-1] == 'h') {

        for(int i=0 ; i<5 ; i++)
            if(isdigit(s[i])) s1 += s[i];

        if(s1 == "31") cout << "7";
        else if(s1 == "30") cout << "11";
        else cout << "12";
    }

    else {

        if(s[0] == '5' || s[0] == '6') cout << "53";
        else cout << "52";
    }

    return 0;
}

using namespace std;
#include <iostream>
#include <string>

int main()
{
	int n;
	string s;
	cin >> n;
	getline(cin, s);
	if (s[s.size() - 1] == 'h')
	{
		if (n == 30)
			cout << 11 << endl;
		else if (n == 31)
			cout << 7 << endl;
		else
			cout << 12 << endl;
	}
	else
	{
		if (n <= 4 || n == 7)
			cout << 52 << endl;
		else
			cout << 53 << endl;
	}

	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main()
{
    int x;
    string s1,s2;
    cin>>x>>s1>>s2;
    if (s2=="month"&&x<=29){
        cout<<"12";
        return 0;
    }
    else if (s2=="month"&&x>28&&x<31){
        cout<<"11";
        return 0;
    }
    else if (s2=="month"&&x==31){
        cout<<"7";
        return 0;
    }
    else if (s2=="week"&&x!=6&&x!=5){
        cout<<"52";
        return 0;
    }
    else cout<<"53";
    return 0;
}

//BINARY_BOY!!
//Bool THINK TWICE CODE ONCE = true;
//Im back basterds
//KEEP CALM AND FUCK PYTHON
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
#include <iomanip>
#include <sstream>
#include <limits>
#include <queue>
using namespace std;
const int MAXN = 1e5;
#define salar long double
#define mp make_pair
#define sp setprecision
#define pb push_back
#define pp pop_back
#define oold numeric_limits<long double>::max()
#define _oold numeric_limits<long double>::min()
#define ooint numeric_limits<int>::max()
#define _ooint numeric_limits<int>::min()
#define ooll numeric_limits<long long>::max()
#define _ooll numeric_limits<long long>::min()
#define ct cout
#define vec vector
#define fx fixed
#define cn cin
#define input readInt()
#define print writeInt
#define pc(x) putchar(x)
typedef long long ll;
typedef int int1;
#define int ll
#define pii pair < int , int>
#define ppi pair < pair < int , int > , int>
#define pip pair < int , pair < int , int > >
void show(long double a , int x , bool endofline , bool space)
{
	ct << fx << sp(x) << a;
	if(endofline)
		ct << endl;
	if(space)
		ct << ' ';
}
salar readInt () {
	bool minus = false;
	salar result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}
inline void writeInt (long long n) {
	long long  N = n, rev, count = 0;
	rev = N;
	if (N == 0) { pc('0'); pc('\n'); return ;}
	while ((rev % 10) == 0) { count++; rev /= 10;} //obtain the count of the number of 0s
	rev = 0;
	while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}  //store reverse of N in rev
	while (rev != 0) { pc(rev % 10 + '0'); rev /= 10;}
	while (count--) pc('0');
}
ll i , x , z , j;
ll months [ 12 ] = {31 , 29 , 31 , 30 , 31 , 30 , 31 ,31 , 30 , 31 , 30 , 31};
vec < ll > v;
set < ll > st;
pii p;
string s;
bool flag ;
void debug() {
	cout << "DEBUGGING\n";
}
/* Graph algorithms :
void dfs(ll a)
{
	flag [ a ] = true;
	for(i = 0 ; i < v[ a ].size() ; i++)
		if(!flag [ v [ a ][ i ]])
			dfs(v [ a ][ i ]);
}
void bfs( vec < ll > starters , ll find)
{
}
ll MST ( vector  < pip > v )q
{

}
*/

int1 main() {
	ios::sync_with_stdio(false) , cn.tie(0) , ct.tie(0);
	ll n ,  ans = 0;
	string s;
	cn >> n >> s >> s;
	if(s == "month")
	{
		for(i = 0 ; i < 12 ; i++)
			if(months [ i ] >= n)
				ans++;
	}
	else{
		for(i = 0 , j = 4 ; i < 366 ; i++ , j ++ , j %= 7)
			if(j + 1 == n)
				ans++;
	}
	cout << ans;
}

#include<bits/stdc++.h>
using namespace std;

int main() {
int x;
scanf("%d", &x);
char sl[15];
scanf("%s", sl);
scanf("%s", sl);
if(sl[0] == 'w') {
if(x == 5 || x == 6) puts("53");
else puts("52");
return 0;
}
if(x <= 29) puts("12");
else if(x <= 30) puts("11");
else puts("7");
return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio("0");
  cin.tie(0);
  ll x;
  cin >> x;
  string s;
  cin >> s;
  cin >> s;
  if(s == "week") {
    if(x == 6 || x == 5) {
      cout << "53";
    } else {
      cout << "52";
    }
  } else {
    if(x == 31) {
      cout << 7;
    } else if(x > 29) {
      cout << 11;
    } else {
      cout << 12;
    }
  }
}

#include <iostream>
#include <string>

using namespace std;

int main(){
	int a; string b, c;
	cin>> a>> b>> c;

	if (c == "week"){
		if (a == 5 || a == 6){
			cout<< 53;
		}
		else {
			cout<< 52;
		}
	}
	else {
		int total = 52*7 + 2;
		if (a == 31)
			cout<< 7;
		else if (a == 30)
			cout<< 11;
		else
			cout<< 12;
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
  int x;
  string period;
  cin>>x;
  cin>>period>>period;

  if(period == "week"){
    if( x == 7)cout<<52;
    else if(x>=5)cout<<53;
    else cout<<52;
  }else{
    if( x==30 )cout<<11;
    else if(x==31)cout<<7;
    else cout<<12;
  }

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int Gcd(int a,int b){if (b == 0) return a; return Gcd(b , a%b);}
int Lcm(int a, int b){ return a/Gcd(a,b)*b;}
inline long long read(){
   long long f = 1, x = 0;char ch = getchar();
    while (ch > '9' || ch < '0'){if (ch == '-')f = -f;ch = getchar();}
    while (ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}
    return x * f;
}
const int maxn = 1e6 + 10;
int vis[maxn];
int mon[maxn] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
    int n;
    string c1,c2;
    cin >> n >> c1 >> c2;
    if (c2[0] == 'w'){
        int wek = 4,ans = 0;
        for(int i=1; i<=366; i++){
            if(wek + 1 == n){
                ans++;
            }
            wek = (wek + 1) % 7;
        }
        cout << ans << endl;
    }else{
        int m = 1,day = 0,ans = 0;
        for(int i=1; i<=366; i++){
            day++;
            if (day == n) ans++;
            if (day >= mon[m]){
                day = 0;
                m++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std ;
int main() {
	int n ;
	string s , s1;
	cin >> n >> s1 >> s ;
		if(s == "week") {
			if(n == 5 || n == 6 ) {
				cout << "53" ;
				return 0 ;
			}
			else{
				cout << "52" ;
				return 0;
		}
	}
	else{
		if(n <= 29) {
			cout << "12" ;
			return 0;
		}
		if( n > 30) {
			cout << "7" ;
			return 0 ;
		}
		else{
			cout << "11" ;
			return 0 ;
		}
	}
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  string a,b;
  cin>>n>>a>>b;

  if(b=="week")
  {
      if( n==5||n==6)
      {
          cout<<53<<"\n";
      }
      else
      cout<<52<<"\n";
  }
  else if(b=="month")
  {
      if(n==31) cout<<7<<"\n";
      else if(n==30) cout<<11<<"\n";
      else cout<<12<<"\n";
  }

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	char s[3],ss[10];
	while(~scanf("%d%s%s",&n,s,ss)){
		if(!strcmp(ss,"month"))
			if(n<30) printf("12\n");
			else if(n==30) printf("11\n");
				else printf("7\n");

		if(!strcmp(ss,"week"))
			if(n==6||n==5) printf("53\n");
			else printf("52\n");

	}
}

#include<bits/stdc++.h>

#define NN 11
using namespace std;
typedef long long INT;
typedef pair<int,int> pii;

int main(){
	int n;
	char s[4],ss[10];
	while(~scanf("%d%s%s",&n,s,ss)){
		if(!strcmp(ss,"month")){
			if(n<30)cout<<12<<endl;
			else if(n==30) cout<<11<<endl;
			else cout<<7<<endl;
		}
		else{
			if(n==5||n==6) cout<<53<<endl;
			else cout<<52<<endl;
		}
	}
}

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define orta (bas + son >> 1)
#define sag (k + k + 1)
#define sol (k + k)
#define endl '\n'
#define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++)
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)
#define mp make_pair
#define nd second
#define st first
#define type(x) __typeof(x.begin())

typedef pair < int ,int > pii;

typedef long long ll;

const long long linf = 1e18+5;
const int mod = (int) 1e9 + 7;
const int logN = 17;
const int inf = 1e9;
const int N = 2e5 + 5;

int x;
string s1, s2;
int main() {

	cin >> x >> s1 >> s2;
	if(s2 == "week") {
		if(x == 5 || x == 6) cout << 53 << endl;
		else cout << 52 << endl;
		return 0;
	}
	if(x <= 29) cout << 12 << endl;
	else if(x <= 30) cout << 11 << endl;
	else cout << 7 << endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define For(i,a,b) for(int i=a;i<b;i++)
#define Efor(i,a,b) for(int i=a;i<=b;i++)
#define Nfor(i,a,b) for(int i=b;i>a;i--)
#define debug(x) cout<<"DEBUG------> "<<x<<endl;

int main() {

	int n; cin >> n;
	string s, a;
	cin >> s >> a;
	if (a[0] == 'm') {
		if (n <= 29)
			cout << 12 << "\n";
		else if (n == 31)
			cout << "7\n";
		else
			cout << 11 << "\n";
	}
	else {
		if (n == 5 || n == 6)
			cout << 53 << "\n";

		else
			cout << "52\n";
	}
	return 0;

}

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	int x;
	string s1, s2;
	cin >> x >> s1 >> s2;
	if (s2 == "week")
	{
		if (x >= 5&&x!=7)
			cout << 53 << endl;
		else
			cout << "52" << endl;
	}

	else
	{
		if (x <= 29)
			cout << 12 << endl;
		else if (x == 30)
			cout << 11 << endl;
		else if (x == 31)
			cout << 7 << endl;
	}
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int x, ans = 0;
	cin >> x;

	string str;
	cin >> str >> str;

	if (str == "week") {
		int day = 4;
		for (size_t i = 0; i < 366; i++) {
			if (day + 1 == x) ans++;
			day = (day + 1) % 7;
		}
	}
	else {
		if (x < 30) ans = 12;
		else if (x < 31) ans = 11;
		else ans = 7;
	}

	cout << ans << '\n';
	//system("pause");
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define node pair<long long,long long >
#define sc second
#define f first
#define islam  ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

int main()
{
    islam
    ll n,m,ans=0,mx=0,mn=1e18,x;
    cin>>n;
    string s;
    cin>>s;
    cin>>s;
    if(s=="week")
    {
        if(n==5||n==6)
            cout<<53;
        else
        cout<<52<<endl;
        return 0;
    }
    if(n==30)
        cout<<11;
    else if(n==31)
        cout<<7;
    else
        cout<<12;
        cout<<endl;
    return 0;
}

#define _USE_MATH_DEFINES
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <string>
#include <unordered_map>
#include <unordered_set>

using namespace std;

char s[10],str[10];
int x,ans,i;

int main()
{
    scanf("%d%s%s",&x,&s,&str);
    if(str[0]=='w')
    {
        x--;
        for(i=0;i<366;i++)
        {
            if((i+4)%7==x)
                ans++;
        }
        printf("%d\n",ans);
    }
    else
    {
        if(x<=29)
            puts("12");
        else if(x<=30)
            puts("11");
        else puts("7");
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    char a[3],b[6];
    scanf("%d %s %s",&n,&a,&b);
    if(b[0] == 'w')
    {
        if(n==5 || n==6)
            printf("53\n");
        else
            printf("52\n");
    }
    else
    {
        if(n<30)
            printf("12\n");
        if(n==30)
            printf("11\n");
        if(n==31)
            printf("7\n");
    }
    return 0;
}

#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;

void getDays(string in)
{
	string loc;
	int lc;

	if (in.at(in.length() - 1) == 'k')
	{
		loc = in.at(0);
		lc = stoi(loc);
		if (lc == 5 || lc == 6)
			cout << 53;
		else
			cout << 52;
	}
	else
	{
		if (in.at(1) == ' ')
			loc = in.at(0);
		else
			loc = in.substr(0, 2);

		lc = stoi(loc);

		if (lc < 30)
			cout << 12;
		else
			if (lc == 30)
				cout << 11;
			else
				cout << 7;
	}

}

int main()
{
	string in;

	getline(cin, in);

	getDays(in);

	//system("pause");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{   int n;string of,d;
    cin>>n>>of>>d;

    if(d=="week")
    {
    	if(n==6||n==5)
    	   cout<<53;
    	else
    	   cout<<52;
	}
    else
    {
    	if(n==31)
    	  cout<<7;
    	else if(n==30)
    	  cout<<11;
    	else
    	  cout<<12;
	}
	return 0;
}

#include <stdio.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#include <string.h>
using namespace std;
typedef long long int ll;
int n;
char s[100];
char trash[100];
int ans;
void call1(int u)
{
//	printf("week");
	int cur=4;
	int i;
	for(i=1 ; i<=366 ; i++)
	{
		cur=cur%7+1;
		if(cur==u)
		{
			ans++;
		}
	}
}

void call2(int u)
{
//	31 29 31 30 31 30 31 31 30 31 30 31
	//printf("month");
	if(u<=30)
	{
		ans+=4;
	}
	if(u<=29)
	{
		ans+=1;
	}
	if(u<=31)
	{
		ans+=7;
	}
}
int main(void)
{
	scanf("%d",&n);
	scanf("%s",&trash[1]);
	scanf("%s",&s[1]);
	if(s[1]=='w')
	{
		call1(n);
	}
	else
	{
		call2(n);
	}
	printf("%d",ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define unq uique
#define rev reverse
int main()
{
    int n; cin>>n;
    string a,b; cin>>a>>b;
    if (b=="week")
    {
        if(n==6||n==5){cout<<53;}
        else if(n==1||n==2){cout<<52;}
        else cout<<(366-n+7)/7;
    }
    else
    {
        if (n>29&&n<31){cout<<11;}
        else if(n==31){cout<<7;}
        else cout<<12;
    }
}

#include <cmath>
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int x;
    string i, j;
    cin >> x >> i >> j;

    if(j == "month")
    {
        if(x<30)
        {
            cout<<"12";
        }
        else if(x==30)
        {
            cout<<"11" ;
        }
        else
        {
            cout<<"7" ;
        }
    }
   if(j == "week")
   {
       if(x==5 || x==6)
       {
           cout<<"53";
       }
       else
       {
            cout<<"52";
       }

   }
   return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <utility>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <fstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <ctime>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define INF 1000000000000000000ll
#define inf 1000000000
#define fname ""
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define F first
#define S second

int main()
{
	int x;

	string str;

	cin >> x >> str >> str;

	if (str == "month")
	{
		if (29 >= x)
			cout << 12 << endl;
		else if (31 > x)
			cout << 11 << endl;
		else
			cout << 7 << endl;

	}
	else
	{
		if (x - 4 > 0 && x - 4 <= 2)
			cout << 366 / 7 + 1 << endl;
		else
			cout << 366 / 7 << endl;
	}
}

#include<stdio.h>
#include<string.h>
int main()
{
             long long int n,a;
             char str[1005];
             scanf("%lld ",&n);
             gets(str);
             a=strlen(str);
             if(str[a-1]=='k'){
                          if(n==6 || n==5)printf("53");
                          else if(n>=1 && n<=7)printf("52");
                          else printf("0");
             }
             else if(str[a-1]=='h'){
                          if(n>=1 && n<=29)printf("12");
                          else if(n>=1 && n<=30)printf("11");
                          else if(n>=1 && n<=31)printf("7");
                          else printf("0");
             }
             return 0;
}

// #include <iostream>
// #include <map>
// #include <algorithm>
// #include <cstdio>
// #include <cstring>
// using namespace std;
// map<int, int>mp;
// int a[400000 + 10];
// int b[100010];
// int n, q;

// int gcd(int x, int y) {
// 	if (y == 0)return x;
// 	return gcd(y, x % y);
// }

// void add(int l, int r, int v, int ll, int rr, int k) {
// 	if (l == ll && r == rr) {
// 		a[k] = gcd(a[k], v);
// 		return ;
// 	}
// 	int mid = (ll + rr) / 2;
// 	if (r <= mid)add(l, r, v, ll, mid, k << 1);
// 	else if (l > mid) add(l, r, v, mid + 1, rr, k << 1 | 1);
// 	else {
// 		add(l, mid, v, ll, mid, k << 1);
// 		add(mid + 1, r, v, mid + 1, rr, k << 1 | 1);
// 	}
// 	a[k] = gcd(a[k << 1], a[k << 1 | 1]);
// }

// int query(int l, int r, int ll, int rr, int k) {
// 	if (l == ll && r == rr) {
// 		return a[k];
// 	}
// 	int mid = (ll + rr) >> 1;
// 	if (r <= mid)return query(l, r, ll, mid, k << 1);
// 	else if (l > mid)return query(l, r, mid + 1, rr, k << 1 | 1);
// 	else return gcd(query(l, mid, ll, mid, k << 1), query(mid + 1, r, mid + 1, rr, k << 1 | 1));
// }

// int main() {
// 	int T;
// 	int C = 1;
// 	cin >> T;
// 	while (T--) {
// 		mp.clear();
// 		memset(a, 0, sizeof(a));
// 		scanf("%d", &n);
// 		for (int i = 1; i <= n; i++) {
// 			scanf("%d", &b[i]);
// 			add(i, i, b[i], 1, n, 1);
// 		}
// 		int ggcd;
// 		for (int i = 1; i <= n; i++) {
// 			ggcd = b[i];
// 			for (int j = i; j <= n; j++) {
// 				ggcd = gcd(ggcd, b[j]);
// 				if (ggcd == 1) {
// 					mp[1] += n - j + 1;
// 					break;
// 				} else {
// 					mp[ggcd]++;
// 				}
// 			}
// 		}
// 		int l, r;
// 		scanf("%d", &q);
// 		printf("Case #%d:\n", C++);
// 		for (int i = 0; i < q; i++) {
// 			scanf("%d%d", &l, &r);
// 			int ans = query(l, r, 1, n, 1);
// 			printf("%d %d\n", ans, mp[ans]);
// 		}
// 	}
// 	return 0;
// }

#include <iostream>
#include <string>
using namespace std;

int main(){
	int x,ans;
	string s;
	cin>>x>>s>>s;
	if(s[0]=='w'){
		if(x==6||x==5)ans=53;
		else ans=52;
	}else{
		if(x==30)ans=11;
		else if(x==31)ans=7;
		else ans=12;
	}
	cout<<ans<<endl;
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main ()
{
    string a;
    int x;
    cin >> x >> a >> a;

    if (a == "month")
    {
        if (x <= 29)
        {
            cout << "12\n";
            return 0;
        }
        if (x == 30)
        {
            cout << "11\n";
            return 0;
        }
        cout << "7\n";
        return 0;
    }
    int res = 0, b = 5;
    for (int i = 1; i <= 366; ++i)
    {
        if (b == x)
            ++res;
        b++;
        if(b == 8)
            b = 1;
    }
    cout << res << "\n";
    return 0;
}

#include<bits/stdc++.h>
#include<math.h>
#include<sstream>
#define str string
#define ll long long int
#define con continue

#define rt return 0
#define fr first
#define sec second
#define pf push_front
#define pb push_back
#define vb vct.begin()
#define ve vct.end()
#define ib it.begin()
#define ie it.end()
#define lb lst.begin()
#define le lst.end()
#define mb mp.begin()
#define me mp.end()
#define sb st.begin()
#define se st.end()
#define strb s.begin()
#define stre s.end()

using namespace std;
const ll mxn=1e5+1;
ll mxx=-1,anss=-1;
str s,s1,s2,s3;
 char ch[10000][10000];
ll strr1[10000],strr2[1000];
int main()
{
//ll tc,dlr; cin>>tc; while(tc--){
ll n,m,i,z,j,a=0,ans=0,k=0,cnt=0,b;
  ll c=0,x,y,d=0,sum=0,mn=INT_MAX,mx=0;
  str ss,strn;
  char ch;
   map<ll,ll>mp;

   cin>>n>>s1>>s2;
   if(s2=="week")
    {
     if(n==5 || n==6)ans=53;
     else ans=52;
    }
   else
    {
     if(n==31)ans=7;
     else if(n==30)ans=11;
       else ans=12;
    }
  cout<<ans<<endl;
// }

            rt;

}
      /*vector<ll>vct;
    vector<ll>::iterator vit;

   //memset(ara,0,sizeof(ara));
    map<ll,ll>mp;
    map<ll,ll>::iterator it;
     map<ll,ll>bp;
    pair<ll,ll>pr[n+1];
   //pair<ll,ll>::iterator pit;

    /*list<ll> lst;
    list<ll>::iterator lit;

    set<ll>st;
    set<ll>::iterator sit;*/

#include <iostream>
#include <string>
using namespace std;
int d;
string a, b;
int mas[7] = {1, 1, 1, 1, 2, 2, 1};
int mas2[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main()
{
    cin >> d >> a >> b;
    if(b == "week")
        cout << 51 + mas[d-1];
    else
        {
           int cnt = 0;
           for(int i = 0; i < 12; i++)
                cnt+=(d <= mas2[i]);
            cout << cnt;
        }
    return 0;
}

#include<iostream>
#include<set>
#include<cmath>

using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	getline(cin,s);
	//cout<<s;
	if(s==" of month")
	{
		if(n==30)
		cout<<11;
		if(n==31)
		cout<<7;

		if(n<=29)
		cout<<12;
	}
	else
	{
		if(n<=4)
		cout<<52;
		if(n==5)
		cout<<53;
		if(n==6)
		cout<<53;
		if(n==7)
		cout<<52;

	}

}

#include<bits/stdc++.h>

using namespace std;

int main(){

	int n;

	char str1[10],str2[10];

	cin>>n>>str1>>str2;

	if(strcmp(str2,"week")==0){

		if(n==5 || n==6) printf("53\n");

		else printf("52\n");

		return 0;

	}

	if(strcmp(str2,"month")==0){

		if(n==31) printf("7\n");

		if(n==30) printf("11\n");

		if(n<=29) printf("12\n");

		return 0;

	}

}

#include <bits/stdc++.h>
//MACROS//
#define FREEELO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define INF 0x3F3F3F3F
#define all(v) v.begin(), v.end()
#define f first
#define s second
#define mod 1000000007
#define MOD 998244353
#define loop1(i, n) for (long long i = 1; i <= (n); i++)
#define loop0(i, n) for (long long i = 0; i < (n); i++)
#define loop(i, k, n) for(long long i = (k);(k) < (n) ? i < (n) : i > (n);(k) < (n) ? i++ : i--)
using namespace std;
int T;
int main()
{
    FREEELO
    int n; string s, ss; cin >> n >> s >> ss;
    if(ss == "month")
    {
        if(n == 31) cout << 7;
        else if(n == 30) cout << 11;
        else cout << 12;
    }
    else
    {
        if(n == 5 || n == 6) cout << 53;
        else cout << 52;
    }
    return 0;
}

    #include <iostream>
    #include <string>
    #include <bits/stdc++.h>
    using namespace std;
    int min1(long long  arr[],long long n)
    {
        int l;
        long long  x=1000000000;
        for(int i=0;i<n;i++)
        {
        if (arr[i]<x&&arr[i]%2==1)
            {x=arr[i];
            l=i;
            }
        }
        return l;

    }

    int main()
    {

        int x;
        string y;
        cin>>x;
        getline(cin,y);
        if (y==" of week")
            {
                if (x==5||x==6)
                cout<<53;
                else
                cout<<52;
            }
        else if (y==" of month")
        {
            if (x==31)
                cout<<7;
            else if (x==30)
                cout<<11;
            else
                cout<<12;

        }

        return 0;
    }

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	char s[3],ss[10];
	while(~scanf("%d%s%s",&n,s,ss)){
		if(!strcmp(ss,"month")){
			if(n<30) printf("12\n");
			else if(n==30) printf("11\n");
			else printf("7\n");
		}
		if(!strcmp(ss,"week")){
			if(n==6||n==5) printf("53\n");
			else printf("52\n");
		}
	}
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <functional>
#include <string>
#include <sstream>
#include <ctime>
#include <bitset>
#include <cstdlib>
#include <stack>
#include <iomanip>

using namespace std;

#define     For(i,a,b)        for (i=a; i<b; i++)
#define     FoR(i,a,b)        for (i=a; i<=b; i++)
#define     Rep(i,a)          for (i=0; i<a; i++)
#define     FIT(it,v)         for (it=(v).begin(); it!=(v).end(); ++it)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     Sort(x)           sort(ALL(x))
#define     SF                scanf
#define     PF                printf

#define     EPS         1e-8
#define     PI          acos(-1)
#define     MAXN        1005
#define     MOD         1000000007
#define     INF         1000000000
#define     X           first
#define     Y           second

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pdd> vdd;

int main(){
    int x, ans;
    string s1, s2;
#ifndef ONLINE_JUDGE
    freopen("c:\\acm_inp\\test.in", "r", stdin);
    //freopen("C:\\acm_inp\\.out", "w", stdout);
#endif
    //ios_base::sync_with_stdio(false)
    //no endl in large files.
    cin >> x >> s1 >> s2;
    ans = 0;
    if (s2 == "week"){
        if (x == 5 || x == 6)cout << 53 << endl;
        else cout << 52 << endl;
    }
    else{
        if (x == 31) ans = 7;
        else if (x == 30) ans = 11;
        else ans = 12;
        cout << ans << endl;
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
int d ;
string c , c2 ;
cin >> d >> c >> c2 ;
if(c2 == "week" ) {
    if ( d == 5  or d == 6 )
        cout << 53 ;
    else
     cout << 52 ;
}

if( c2 == "month" ) {
    if ( d <= 29 )
        cout << 12 ;
    else if ( d == 31 )
    cout << 7 ;
    else
    cout << 11 ;
}

}

#include<Bits/stdc++.h>

using namespace std;
typedef long long int ll;
#define boi	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define file freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
#define F first
#define S second
#define kill(x) return cout<<(x),0;
const ll inf=1e17;
const ll mx=2e5+10;
const ll mod=1e9+7;
ll n,m,k,tmp,Q,a,b,d,sum,f,p,id,id2,mwx,mn,A[mx],B[mx],mid=0,L,R,ans,x[12]={31,29,31,30,31,30,31,31,30,31,30,31};
pair<ll,ll>pp[mx];
string s,c;
int main()
// 0 1 2 3 4 5
//     1
{
    getline(cin,s);
    if (s[s.size()-1]=='k')
    {
        if (s[0]-'0'==5 || s[0]-'0'==6)
            kill(53);
        kill(52);
    }
    else
    {
        c+=s[0];
        c+=s[1];
        for (ll i=0;i<12;++i)
        {
            if (x[i]>=stoll(c))
                ans++;
        }
        cout<<ans;
    }
    return 0;
}
/*
93647 7 451664565
*/

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    char input[20],temp[10];
    int num,i,j;
    while(gets(input))
    {
        num=atoi(input);
        for (i=0;input[i]!='\0';i++)
        {
            if (input[i]=='w'||input[i]=='m')
            {
                j=0;
                while(input[i]!='\0')
                {
                    temp[j]=input[i];
                    i++;
                    j++;
                }
                temp[j]='\0';
                break;
            }
        }
        if (strcmp(temp,"month")==0)
        {
            if (num==31)
                cout<<'7'<<endl;
            else if (num==30)
                cout<<"11"<<endl;
            else
                cout<<"12"<<endl;
        }

        else if (strcmp(temp,"week")==0)
        {
            if (num==6||num==5)
                cout<<"53"<<endl;
            else
                cout<<"52"<<endl;
        }
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    string str;
    getline(cin , str);
    int x = 0;
    int ok = 0;
    for(int i = 0 ; i < str.length() ; i++)
    {
        if(isdigit(str[i]))
        {
            x += str[i] - '0';
            x*=10;
        }
        if(str[i] == 'w')
        {
            ok = 1;
            break;
        }
    }
    x/=10;
    if((x == 6 || x == 5) && ok == 1)
    {
        cout << "53" << endl;
        return 0;
    }
    if(ok == 1)
    {
        cout << "52" << endl;
    }
    else
    {
        if(x == 31)
        {
            cout << 7 << endl;
        }
        else if(x == 30)
        {
            cout << 11 << endl;
        }
        else
        {
            cout << 12 << endl;
        }
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define st first
#define nd second

typedef long long LL;
typedef long double LD;
typedef pair<int, int> II;

const int N=1111111;
const LL INF=1e12;

char s[50];
int a,b;

main()
{ ios::sync_with_stdio(false); cin.tie(NULL);
  int x;
  gets(s);
  int n=strlen(s);
  if(s[n-1]=='h')
  { a=s[0]-'0';
    b=s[1]-'0';
    if(b==-16) x=a;
     else
      x=10*a+b;
    if(x<=29) return cout << 12,0;
    if(x==30) return cout << 11,0;
    if(x==31) return cout << 7,0;
  }
  if(s[n-1]=='k')
  { x=s[0]-'0'+1;
    if(x==2) return cout << 52,0;
    if(x==3) return cout << 52,0;
    if(x==4) return cout << 52,0;
    if(x==5) return cout << 52,0;
    if(x==6) return cout << 53,0;
    if(x==7) return cout << 53,0;
    if(x==8) return cout << 52,0;
  }
}

#include <bits/stdc++.h>
using namespace std;
const int maxn = 20;
int arr[maxn] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, n, ans = 0;
string a, s;

int main() {
	cin >> n >> a >> s;
	if(n > 4 && n < 7 && s == "week") {
		cout << 53;
		return 0;
	}
	else if(s == "week") {
		cout << 52;
		return 0;
	}
	if(s == "month") {
		for(int i = 0; i < 12; i++) {
			if(n <= arr[i]) ans++;
		}
	}
	cout << ans;
	return 0;
}

#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main()
{
    string a,v;
    int b;
    cin>>b>>v>>a;

    if((a=="week")&&(b==6))
        cout<<53;
    else if((a=="week")&&(b==5))
        cout<<53;
    else if((b==6)&&(a=="week"))
            cout<<53;
    else if((b==30)&&(a=="month"))
        cout<<11;
    else if((b==31)&&(a=="month"))
        cout<<7;
    else if(a=="week")
        cout<<52;
    else
        cout<<12;
    return 0;
}

#include <iostream>
#include <string>
using namespace std;
void main()
{
    string s; int x;
    cin >> x >> s >> s;
    if (s == "month")
    {
        if (x == 31)
            cout << 7;
        else if (x == 30)
            cout << 11;
        else cout << 12;
    }
    else
    {
        if (x==5||x==6)cout << 53;
        else cout << 52;
    }
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i ,n,ans;
	char a[20],b[10];
	cin>>n>>a>>b;

	if(b[0]=='w')
	{
		if(n==5 || n==6)
		cout<<"53";
		else
		cout<<"52";

	}
	else
	{
		if(n<=29)
		cout<<"12";
		else if(n==31)
		cout<<"7";
		else
		cout<<"11";
	}
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n ;
    string s , x ;
    cin >> n >> x >> s ;
    if ( s == "week")
    {
        if ( n == 6 or n == 5  )
            cout << 53 ;
        else
            cout << 52 ;
    }
    else
    {
        if ( n < 30 )
            cout << 12 ;
        else if ( n == 30 )
            cout << 11 ;
        else
            cout << 7 ;
    }
}

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int x;
    string a,b;
    cin>>x>>a>>b;
    if (b=="month")
    {
    if (x<30) cout<<12;
	else if (x==30) cout<<11;
	else if (x==31) cout<<7;
    return 0;
    }
    if (x<5) cout<<52;
    else if (x==7) cout<<52;
    else cout<<53;
	return 0;
}

#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <ctime>
#include <string>
#include <iostream>
#include <cassert>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<ll, ll> par;
typedef vector<par> vpar;
typedef vector<bool> vbool;

#define forn(i, b, n) for (int i = b; i < n; ++i)
#define rforn(i, b, n) for (int i = b; i >= n; --i)
#define get(n) scanf("%I64d", &n)
#define out(n) printf("%I64d ", n)
#define getf(n) scanf("%f", &n)
#define outf(n) printf("%f", n)
#define vec vector
#define mp make_pair
#define add push_back
#define del pop_back
#define F first
#define S second
#define pw(x) (1ll << (x))
#define sqr(x) ((x)*(x))
#define all(x) (x).begin(), (x).end()

const ll INF = ll(1e18);
const ll MOD = ll(1e9) + 7;
const ll P = 259;
const ld EPS = 1e-10;

inline void getV(vll &a, ll n) {
	a.resize(n);
	forn(i, 0, n) {
		get(a[i]);
	}
}

inline void getVV(vvll &a, ll n, ll m) {
	a.resize(n);
	forn(i, 0, n) {
		getV(a[i], m);
	}
}

inline void ok() {
	printf("1\n");
}

inline void no() {
	printf("NO\n");
}

inline void error() {
	printf("2\n");
	exit(0);
}

inline ll logn(ll n) {
	ll xx = ll(log2(ld(n)));
	return xx;
}

#define TASK "treedp"

int source() {
	ios::sync_with_stdio(0);
	ll num;
	string of, type;
	cin >> num;
	cin >> of >> type;
	if (type == "month") {
		if (num < 30) {
			cout << 12;
		}
		else {
			if (num == 31) {
				cout << 7;
			}
			else cout << 11;
		}
	}
	if (type == "week") {
		if (num == 5 || num == 6) cout << 53;
		else cout << 52;
	}
	return 0;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#else
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//freopen(TASK".in", "r", stdin);
	//freopen(TASK".out", "w", stdout);
#endif
	srand(time(0));
	source();
	return 0;
}

#include <iostream>
#include <set>
using namespace std;

int main()
{
	int n ;
	string s ;
	cin >> n ;
	getline(cin,s);
	int week[] = {52,52,52,52,53,53,52} ;
	if(s == " of week")
		cout << week[n-1] << endl ;
	else
	{
		if(n == 30)
			cout << 11<<endl ;
		else if(n == 31)
			cout << 7<<endl ;
		else
			cout << 12 << endl ;
	}
	return 0 ;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
    int n;
    string s;
    cin >> n >> s >> s;
    if(s[0] == 'w'){
        cout << 52 + (n > 4 && n < 7 ? 1 : 0);
    }else{
        if(n < 30){
            cout << 12;
        }else if(n == 31){
            cout << 7;
        }else{
            cout << 11;
        }
    }
}

#include<string>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int a;
    cin>>a;
    string b,c;
    cin>>b>>c;
    if(c=="week" && a<5 ||c=="week" && a>6  ){
        cout<<52;
    }
    else if(c=="week" && a>=5 && a<7){
        cout<<53;
    }
    else if(c=="month" && a>29 && a<31){
        cout<<11;
    }
    else if(c=="month" && a<=29){
        cout<<12;
    }
    else if(c=="month" && a>=30 && a<31){
        cout<<11;
    }
    else if(c=="month" && a==31){
        cout<<7;
    }
}

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <string>
#include <cmath>
#define INF 99999999
using namespace std;

const double eps = 1e-10;
const double pi = std::acos(-1.0);

int n;
string s, t;
int main()
{
//  freopen("in.in","r",stdin);
    cin>>n;
    cin>>s>>t;
    if(t == "week")
    {
        if(n==5 || n==6)    cout<<53<<endl;
        else        cout<<52<<endl;
    }
    else
    {   if(n< 30)   cout<<12<<endl;
        else if(n==30)  cout<<11<<endl;
        else    cout<<7<<endl;
    }

    return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int n;
    string k,w;
    cin>>n>>k>>w;
    bool t=false;
    if(w=="month")t=true;
    if((n>=1 && n<=4 || n==7 )&&(w=="week"))cout<<52;
    else if((n==5 || n==6) && (w=="week"))cout<<53;
    else if((n>=1 && n<=29 )&& (t==true))cout<<12;
    else if(n==30)cout<<11;
    else if(n==31)cout<<7;
}

#include <iostream>
#include <string>
using namespace std;

int main ()
{
    int x;
    string s;
    cin >> x ;
    getline (cin,s);
    if (s==" of week"){
        if (x==6|| x==5){cout << 53 << endl;}
        if (x==1||x==2||x==3||x==4||x==7){cout << 52 << endl;}
    }
    else if (s==" of month"){
        if (x<=29){cout << 12 <<endl;}
        else if (x>=29&&x<=30){cout << 11 << endl;}
        else if (x==31){cout << 7 << endl;}
    }
	return 0;
}

#include <iostream>
#include <string>
using namespace std;
int i,j,k,p,l,pat[1000002],n,m;
string s;
int main()
{
    cin>>n>>s>>s;
    if(s=="month")
    {
        if(n==31)
        {
            cout<<7<<endl;
            return 0;
        }
        if(n==30)
        {
            cout<<11<<endl;
            return 0;
        }
        cout<<12<<endl;
        return 0;
    }
    if(n==5 || n==6)
        cout<<53<<endl;
    else
        cout<<52<<endl;
    return 0;
}

/*#include <iostream>
#include <string>
using namespace std;
long long i,j,k,a,b,p,l,pat[1000002],n,m;
string a2,b2,s,a3,b3;
string nerk(long long x)
{
    s="";
    while(x>0)
    {
        s+=x%2+'0';
        x/=2;
    }
    return s;
}
int main()
{
    cin>>a>>b;
    a2=nerk(a);
    b2=nerk(b);
    k=a2.size();
    l=b2.size();
    for(i=a2.size()-1;i>=0;i--)
    {
        if(k==a2.size())
            if(a2[i]=='0')
                k=i;
        if(k!=a2.size())

    }
    return 0;
}*/

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

typedef long long ll;

int n;
string a, b;
int main()
{
	cin >> n >> a >> b;
	if (b == "week"){
		if (n == 5 || n == 6)cout << 53;
		else cout << 52;
	}
	else{
		if (n <= 29)cout << 12;
		else if (n == 30)cout << 11;
		else cout << 7;
	}
	return 0;
}

#include<cstdio>
using namespace std;
char a[10], b[10];
int main()
{
    int x,y;
    scanf("%d%s%s", &x, a, b);
    if (b[0] == 'm')
    {
        y = 12;
        if (x == 30)y = 11;
        else if (x == 31)y = 7;
    }
    else
    {
        y = 52;
        if (x == 5||x==6)y++;
    }
    printf("%d\n", y);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    string a,b;
    cin>>n>>a>>b;
    if(b[0]=='w'){
        if(n>=1&&n<5)cout<<"52"<<endl;
        else if(n==5||n==6)cout<<53<<endl;
        else cout<<52<<endl;
    }
    else if(b[0]=='m') {
        if(n==30)cout<<11<<endl;
        else if(n==31)cout<<7<<endl;
        else cout<<12<<endl;
    }
       return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int x;
    cin>>x;
    string y;
    getline(cin,y);
    int a=52,b=53,c=12,d=11;
    if (y==" of week")
    {
        if (x<=7)
            {
                if (x==1 || x==2 || x==3 || x==4 || x==7)
                {
                    cout<<a<<endl;
                }
                else if (x==5 || x==6)
                    {
                        cout<<b;
                    }
             }
    }
    if (y==" of month")
    {
        if (1<=x && x!=29 && x<30)
        {
            cout<<c;
        }
        if (x==30)
        {
            cout<<d;
        }
        if (x==29)
        {
            cout<<c;
        }
        if (x==31)
        {
            cout<<7;
        }

    }
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main ()
{
		int n;
		string s,c;
		cin>>n>>c>>s;
			if(s=="week")
		{
		    if(n<5)
		  		cout<<365/7;
		  	else if(n>4 && n!=7)
		  		cout<<365/7+1;
		  	if(n==7)
		  		cout<<365/7;
		}
			if(s=="month")
		{
				if(n>29 && n!=31)
					cout<<11;
				else if(n<=29)
					cout<<12;
				else if(n==31)
					cout<<7;
		}
		return 0;
}

// rc.cpp
//

#include <assert.h>
#include <time.h>
#include <math.h>
#include <string.h>

#include <iterator>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>

using namespace std;

#define PI 3.1415926535897932384626433832795
#define EPS 1E-11

typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long long uint64;
typedef long long sint64;

int main()
{
	uint n;
	string s;
	cin >> n >> s >> s;

	uint r = 0;
	if (s == "month")
	{
		if (n <= 29)
			r = 12;
		else if (n == 30)
			r = 11;
		else
			r = 7;
	}
	else
	{
		for (uint i = 0; i < 366; ++i)
		{
			uint d = (i + 4) % 7;
			if (d == n - 1)
				++r;
		}
	}

	cout << r << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
    string str;
    getline(cin,str);
    if(str[4]=='w'){
        if(x==6||x==5)
            cout<<"53\n";
        else
            cout<<"52\n";
    }
    if(str[4]=='m'){
        if(x==31)
            cout<<"7\n";
        else if(x==30)
            cout<<"11\n";
        else
            cout<<"12\n";
    }
    return 0;
}

#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;
int main()
{
    string str;
    getline(cin, str);
    if (str[str.size() - 1] == 'k'){
        if (str[0] == '7') cout << 52;
        else if (str[0] >=53) cout << 53;
        else cout << 52;
    }
    else{
        if ((str[0]<=50 && str[1]<=57) || (str[0] <= 57 && str[1]==' '))
            cout << 12;
        else if (str[0]<=51 && str[1]<=48)
            cout << 11;
        else cout << 7;
    }

    return 0;
}

// ConsoleApplication1.cpp : Defines the entry point for the console application.

#include <stdio.h>

int month(int a, char y);
int week(int a, char y);

int main()
{
	char x[10], z;
	int y;
	//printf("Please W for weekly basis or M for monthly basis\n");

	scanf_s("%d of %s", &y, &x, 6);
	z = x[0];

	if (x[0] == 'm') {
		y = month(y, z);
		printf("%d\n", y);
	}
	else
	{
		if (x[0] == 'w') {
			y = week(y, z);
			printf("%d\n", y);
		}
		else
		{
			printf("invalid input\n");
		}
	}
}
//function for monthly testing
int month(int a, char x)
{

	//printf("enter the date of month\n");
	//scanf_s("%d", &y);
	if (a >= 1 && a <= 29) {
		return (12);
	}
	else
	{
		if (a == 30) {
			return(11);
		}
		else
		{
			if (a == 31) {
				return(7);
			}
			else
			{
				printf("invalid date\nEnter date between 1 & 31\n");
			}
		}
	}
	//return 0;
}

//fucntion for weekly basis
int week(int a, char x)
{
	//printf("enter the day of week\n");
	//scanf_s("%d", &y);
	if (a == 5 || a == 6) {
		return (53);
	}
	else
	{
		if (a >= 1 || a <= 4)
		{
			return(52);
		}
		else
		{
			printf("invlaid input\nenter day between 1 & 7\n");
		}
	}
//	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n;
	string s;
	cin>>s;
	cin>>s;
	if(s=="week"){
		k=52;
		if(n==5||n==6){
			k++;
		}
		cout<<k;
		return 0;
	}
	else {
		if(n>31){
			cout<<0;
			return 0;
		}

		if(n==31){
			cout<<7;
			return 0;
		}
		if(n>29){
			cout<<11;
			return 0;
		} else {
			cout<<12;
			return 0;
		}
	}
}

#include<iostream>

#include<string>

using namespace std;

int main()
{
    string a,b,c;
    cin>>a>>b>>c;
    if(c=="week")
    {
        if(a=="5")cout<<53<<endl;
        else{
            if(a=="6")cout<<53<<endl;
            else cout<<52<<endl;
        }
    }
    else
    {
        int i=a.length();
        int temp;
        if(i==2)temp=(a[0]-'0')*10+a[1]-'0';
        if(i==1)temp=a[0]-'0';
        if((temp<=29))cout<<12<<endl;
        else
        {
            if(temp<=30)cout<<11<<endl;
            else cout<<7<<endl;
        }
    }
    return 0;

}

#include <stdio.h>
int main()
{
	int n;
	char a[10];
	char b[10];
	while(~scanf("%d %s %s",&n,a,b))
	{
		if(b[0]=='w')
		{
			if(n==5||n==6)
				printf("53\n");
			else printf("52\n");
		}
		else if(b[0]=='m')
		{
			if(n==31)
				printf("7\n");
			else if(n==30)
				printf("11\n");
			else
				printf("12\n");
		}
	}
	return 0;
}

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int month[13] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
int week[] = {0,52,52,52,52,53,53,52};
int main()
{
	int p = 0,t=3;
	char a[100],b[100],c[100];
	cin>>a>>b>>c;
	p  = atoi(a);
	if(c[0]=='w')
	{
		//p = atoi(a)
		cout<<week[a[0]-'0']<<endl;
	}
	else
	{
		t = 0;
		//p = week[0] - '0';
		//cout<<p<<endl;
		for(int i =1;i<=12;i++)
		{
			if(month[i]>=p)
			{
				t++;
			}

		}
		cout<<t<<endl;
	}
}

#include<iostream>
using namespace std;
int main(){
	int a;
	string b,c;
	cin>>a>>b>>c;
	if(c=="week"){
		cout<<52;
	}
	else if(a==30)cout<<11;
	else if(a==31)cout<<7;
	else cout<<12;
}

#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <cassert>
#include <fstream>
#include <cstring>
#include <iostream>
#include <algorithm>

#define InTheNameOfGod ios::sync_with_stdio(false); cin.tie(0);

using namespace std;
typedef long long ll;

const int N = 2000 + 5;

int main ()
{
	InTheNameOfGod;
	int x;
	string s, t;
	cin >> x >> s >> t;
	if (t[0] == 'w')
	{
		if (x >= 4) cout << 52 << endl;
		else cout << 51 << endl;
	}else {
		if (x == 31)
		{
			cout << 7 << endl;
		}
		else if (x == 30)
		{
			cout << 11 << endl;
		}
		else {
			cout << 12 << endl;
		}
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){

  int d , t=0 , counter=365 ;
  string a , b;
  cin >> d >> a >> b ;

  if(b == "week")
  {
    if(d <= 3)
    {
      counter -= 7-d ;
      t++ ;
    }
    t += counter / 7 ;
  }
  else
  {
      if(d == 31)
       t = 7 ;
      else if(d == 30 || d <= 3)
       t = 11 ;
      else
       t = 12 ;
  }

   cout << t ;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()

const int a[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("in.txt", "r", stdin);
    int x; string s; cin >> x >> s >> s;
    if(s.back() == 'k') {
        x--;
        int ans = 0;
        for(int i = 0; i < 365; i++)
            if((i + 4) % 7 == x)
                ans++;
        cout << ans;
    } else {
        int ans = 0;
        for(int i = 0; i < 12; i++)
            if(a[i] >= x)
                ans++;
        cout << ans;
    }
}

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define fr first
#define sc second
#define pp pop_back
#define pb push_back
#define pf push_front
#define ppf pop_front
#define r_0 return 0
#define ll long long
#define ld long double
#define TIME ios_base::sync_with_stdio(0);
#define foi freopen( "input.txt", "r", stdin );
#define foo freopen( "output.txt", "w", stdout );

using namespace std;

ll x, cnt;
string s1, s2;
char ch1, ch2;

ll arll[12+1] = { 31, 29, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31 } ;
ll arll1[7] = { 52, 52 };
string arst[1001];
char arch[1001];

vector<ll>v1, v2;
map<ll, ll>mp;
pair<ll, ll>pr[1001];
set<ll>s;
set<ll>::iterator it;

int main(){
    TIME

    cin >> x >> s1 >> s2;

    if ( s2 == "month" ){
        for ( ll i = 0; i < 12; i ++ ){
            if ( arll[i] >= x ){
                cnt ++;
            }
        }
        cout << cnt;
    }else{
        if ( x == 5 ){
            cout << 53;
        }else if ( x <= 4 ){
            cout << 52;
        }else if ( x == 6 or x == 7 ){
            cout << 53;
        }else{
            cout << 58;
        }
    }

    cout << "\n";
    r_0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    char a[3],b[6];
    scanf("%d %s %s",&n,&a,&b);
    if(b[0] == 'w')
    {
        if(n==2 || n==3)
            printf("53\n");
        else
            printf("52\n");
    }
    else
    {
        if(n<29)
            printf("12\n");
        if(n==29)
            printf("1\n");
        if(n==30)
            printf("4\n");
        if(n==31)
            printf("7\n");
    }
    return 0;
}

#include <iostream>

using namespace ::std;

int main()
{
    int x , c = 0;
 start :   cin>>x;
    if( x >= 1 && x<= 7)
    {
        for(int i = 1; i < 365;)
            {
                c++;
                i = i+7;
            }
    }
    else if (x > 7 && x <= 31 )
    {
         if(x == 28 || x == 29)
        c++;
        else
            for(int i = 1 ; i < 12 ;i++)
             c++;
    }
    else
        {
            cout<<"wrong number..reinsert it";
            goto start;
        }

    cout<<c;
    return 0;
}

#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <cassert>
#include <fstream>
#include <cstring>
#include <iostream>
#include <algorithm>

#define InTheNameOfGod ios::sync_with_stdio(false); cin.tie(0);

using namespace std;
typedef long long ll;

const int N = 2000 + 5;

int main ()
{
	InTheNameOfGod;
	int x;
	string s, t;
	cin >> x >> s >> t;

	int k = 31 * 7 + 30 * 4 + 29;

	if (t[0] == 'w')
	{

		x += 3;
		x %= 7;
		int ans = 0;
		int d = 1 + x;
		while (d <= k)
		{
			ans++;
			// cout << k << " " << d << endl;
			d += 7;
		}
		if (x >= 4) cout << ans - 1<< endl;
		else cout <<ans - 1 << endl;
	}else {
		if (x == 31)
		{
			cout << 7 << endl;
		}
		else if (x == 30)
		{
			cout << 11 << endl;
		}
		else {
			cout << 12 << endl;
		}
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define unq uique
#define rev reverse
int main()
{
    int n; cin>>n;
    string a,b; cin>>a>>b;
    if (b=="week")
    {
        if(n==6||n==2){cout<<53;}
        else if(n==1){cout<<52;}
        else cout<<(366-n+7)/7;
    }
    else
    {
        if (n>29&&n<31){cout<<11;}
        else if(n==31){cout<<7;}
        else cout<<12;
    }
}

#include<iostream>
#include<string>
#include<stdlib.h>
#include<sstream>

using namespace std;

int main()
{
    string str;
    getline (cin, str);

    int found=str.find("week");
    if (found!=std::string::npos && found > 1)
    {
        int val;
        istringstream is(str);
        is >> val;
        if(val >= 1 && val <= 7)
            cout<<52;
        else
            //cout<<0;
        return 0;
    }
    found=str.find("month");
    if (found!=std::string::npos && found > 1)
    {
        int val;
        istringstream is(str);
        is >> val;
        if(val<=29)
            cout<<12;
        else if(val==30 || val==31)
            cout<<11;
        else
            //cout<<0;
            return 0;
    }
    /*else
        cout<<0;*/
return 0;
}

#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;

int x,re,a[100005];
string s,s1;

int main(){
cin>>x>>s1>>s;
if(s[0]=='w'){
    re=52;
    if(x==5||x==6) re++;
    else if(x==7) re--;
}
else{
    if(x<=29) re=12;
    else if(x==30) re=11;
    else if(re==31) re=7;
}
cout<<re<<endl;
return 0;
}

#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define endl '\n'
#define pii pair <ll, ll>
#define pb push_back
#define mp make_pair
#define pi 3.14159265358979323846264
#define y1 abacaba
#define fn "abc"
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Need_For_Speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const long long MXN = 1e5 + 1;
const long long MOD = 1e9 + 7;

int main () {

    Need_For_Speed

    ll n;
    string s, t;
    cin >> n >> s >> t;
    if (t == "week") {
        cout << 52;
    } else {
        if (n == 31) {
            cout << 7;
        } else if (n == 30) {
            cout << 11;
        } else {
            cout << 12;
        }
    }
    return 0;
 }

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);

  int a;
  string s,t;
  cin>>a>>s>>t;
  if(t=="week"&&a>=6)cout<<53;
  else if(t=="week")cout<<52;
  else if(a>=31)cout<<7;
  else if(a>=30)cout<<11;
  else cout<<12;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	int x, cnt = 5, ans = 0;
	string str;
	cin >> x >> str >> str;

	for (int i = 1; i <= 366; i++)
	{
		if (cnt > 7) cnt = 1;
		if (cnt == x)
		{
			ans++;
			cout << i << ' ' << cnt << endl;
		}
		cnt++;
	}

	if (str == "week")
	   cout << ans;
	else
	{
		if (x <= 28)
			cout << 12;
		if (x > 28 && x < 31)
			cout << 11;
		if (x == 31)
			cout << 7;
	}
}

#include<iostream>
#include<stdio.h>
#include<sstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<fstream>
#include<ctype.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<bitset>
#include<string>
#include<memory.h>
#include<cmath>
#include<list>
using namespace std;
typedef long long ll;
ll oo = 1e9;
ll nmod(ll a) {
    return (((a % oo) + oo) % oo);
}
typedef pair<int, int> ii;
ll gcd(ll a, ll b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998;
int dx[] = { 0, 0, 1, -1, -1, -1, 1, 1 };
int dy[] = { 1, -1, 0, 0, -1, 1, -1, 1 };
int n, m;
bool vl(int r1, int c1) {
    return r1 > -1 && r1 < n && c1 > -1 && c1 < m;
}
string ar[10000];
string c[] = { "2" , "3" ,"4","5" , "6","7","1" };
//int arr[7] = { , , , , , , 53 };
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    //freopen("output.txt", "w",stdout);
    for (int i = 0; i < 366; i++)
        ar[i] = c[i % 7];
    //cout << ar[362] << "   ";
    //for (int i = 0; i < 366; i++)
    //  cout << ar[i] << " ";
//  cout << endl;
    // 53
    string s;
    getline(cin, s);
    int n;
    stringstream ss;
    ss << s;
    ss >> n;
    ss >> s;
    ss >> s;
    if (s == "week") {
        string sss = c[n - 1];
        int m = 0;
        for (int i = 0; i < 366; i++)
            if (sss == ar[i]) m++;
        cout << m;
    }
    else {
        //|| n == 29
        if (n == 30 ) {
            cout << 11;
        }
        else if(n == 31 ) {
            cout << 7;
        }
        else {
            cout << 12;
        }
    }
        return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    char input[20],temp[10];
    int num,i,j;
    while(gets(input))
    {
        num=atoi(input);
        for (i=0;input[i]!='\0';i++)
        {
            if (input[i]=='w'||input[i]=='m')
            {
                j=0;
                while(input[i]!='\0')
                {
                    temp[j]=input[i];
                    i++;
                    j++;
                }
                temp[j]='\0';
                break;
            }
        }
        if (strcmp(temp,"month")==0)
        {
            if (num==31)
                cout<<'7'<<endl;
            else if (num==30)
                cout<<"11"<<endl;
            else
                cout<<"12"<<endl;
        }
        else if (strcmp(temp,"week")==0)
        {
            if (num==6||num==7||num==5)
                cout<<"53"<<endl;
            else
                cout<<"52"<<endl;
        }
    }
    return 0;
}

#include <iostream>
#include<sstream>
using namespace std;
int a[7];
int main()
{
    int n,idx=5;
    string s1,s2;
    cin>>n>>s1>>s2;
    if(s2=="week")
        {
            if(n==5 || n==6)
                cout<<53;
            else
                cout<<52;
        }
    else
    {
        if(n==29)
            cout<<1;
        else if(n==30)
            cout<<11;
        else if(n==31)
            cout<<7;
        else
            cout<<12;
    }
    return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main()
{
          int n = 0, a = 0, b = 0, k1 = 0, k2 = 0;
          string s = "";
          cin >> n >> s >> s;
          if (s == "month")
          {
                    if (n <= 29)
                    {
                              cout << 12;
                              return 0;
                    }
                    if (n == 30)
                    {
                              cout << 5;
                              return 0;
                    }
                    if (n == 31)
                    {
                              cout << 7;
                              return 0;
                    }
          }
          k1 = 366 / 7;
          k2 = 366 % 7;
          a = 6 + k2;
          if (a > 7)
          {
                    a -= 7;
          }
          if (a >= n)
          {
                    k1++;
          }
          cout << k1;
}

#include <bits\stdc++.h>
using namespace std;

int n, sizes, sum = 0, A[1000000], mini = 9999999, i, j, x, maxi;
map<string, int> ma;

int main()
{
    string s;
	getline(cin, s);
	if(s.find("of month") != -1) {
        if(s[0] + s[1] == '31') {
            cout << 7;
            return 0;
        }
        if(s[0] + s[1] == '30') {
            cout << 11;
            return 0;
        }
        cout << 12;
        return 0;
	}
	else {
        if(s[0] == '6')
            cout << 53;
        else
            cout << 52;
	}
}

#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int x;
	char str[9];
	cin >> x;
	for(int i = 0; i < 6; i++)
	cin >> str[i];
	if(str[5] == 'k')
	{
		if(x == 7)
		{
			cout << 51;
		}
		else if((x == 6)||(x == 5))
		cout << 53;
		else cout << 52;
	}
	else
	{
		cin >> str[6];
		if(x == 31)
		{
			cout << 7;
	}
		else if(x > 28)
		{
			cout << 11;
		}
		else if(x <= 28)
		{
			cout << 12;
		}
	}
	return 0;
}

#include <iostream>

using namespace std;

int main() {
  int x; cin >> x;
  string a, b; cin >> a >> b;
  int result;
  if (b == "week") {
    if (x == 5 || x == 6) {
      result = 53;
    } else {
      result = 52;
    }
  } else if (b == "month") {
    if (x == 29) result = 12;
    else if (x == 30) result = 11;
    else result = 7;
  }
  cout << result << endl;
  return 0;
}

#include <iostream>
using namespace std;

int main() {
  int a;
  cin>>a;
  string b;
  cin>>b;
  string c;
  cin>>c;
  if(c=="month")
  {
     if(a<30)
       cout<<12<<endl;
    if(a==30)
      cout<<11<<endl;
    if(a==31)
      cout<<7<<endl;
  }
  if(c == "week")
  {
     if(a==1)
       cout<<52<<endl;
     if(a==2)
       cout<<52<<endl;
     if(a==3)
       cout<<53<<endl;
     if(a==4)
       cout<<52<<endl;
     if(a==5)
       cout<<53<<endl;
     if(a==6)
       cout<<53<<endl;
     if(a==7)
       cout<<53<<endl;
  }
  return 0;
}

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
    string str;
    getline(cin , str);
    int n;
    if (str[str.size() - 1] == 'k')
    {
        cout << 52 << endl;
    }
    else
    {
        if (str[1] == ' ')
        {
            cout << 12 << endl;
        }
        else
        {
            n = (str[0] - '0' )* 10 + (str[1] - '0');
            if (n == 31)cout << 7 << endl;
            else if (n <= 29)
                cout << 12 << endl;
            else cout << 11 << endl;
        }
    }
}

#include<bits/stdc++.h>
using namespace std;
int main() {
  int a;
  string b, c;
  cin >> a >> b >> c;
  if (c == "week") {
    if(a < 5)
    cout << "52";
    else
    cout << "53";
    return 0;
  }
  else {
    if (a <= 29) {
      cout << "12";
    }
    else if (a == 30) {
      cout << "11";
    }
    else
    cout << "7";
  }
  return 0;
}

#include<bits/stdc++.h>
#define r_0 return 0;
#define ll long long
#define ld  long double
#define pb push_back
#define fr first
#define se second
#define in freopen("input.txt","r",stdin);
#define out freopen("output.txt","w" stdout);
#define TIME ios_base::sync_with_stdio(NULL);
#define tcn cin.tie(NULL);
#define tct cout.tie(NULL);
using namespace std;
ll n;
string s,s1,ans,cnt;
ll used[100001];
set<string>se;
int main()
{
TIME tcn tct
cin >> n >> s >> s1;
 if( n<=29 and s1=="month")
    cout<<12;
 else if( n==30 and s1=="month" )
    cout<<11;
 else if( n==31 and s1=="month" )
    cout<<7;
if( n<=4  and s1=="week" or n==7 )
    cout<<52;
 else if( n>=5 and s1=="week" )
    cout<<53;

}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lli long long
#define mp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define ok return 0;
#define MOAE                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

int main()
{
    MOAE;
    string s;
    getline(cin, s);
    if (s[s.size() - 1] == 'k')
    {
        cout << 52 << endl;
    }
    else
    {
        if (s[0] == '3' and s[1] == '0')
            cout << 11 << endl;
        else
            cout << 12 << endl;
    }
    ok;
}

#include<iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	string b,c;
	cin>>b>>c;
	if(c=="month"&&a==30){
		cout<<11;
	}
	else if(c=="month"&&a<29){
		cout<<12;
	}
	else if(c=="month"&&a==31){
		cout<<7;
	}
	else if(c=="week"){
		cout<<366/7;
	}
}

#include<IoStReaM>
#include<CmAtH>
#include<IoManIp>
#include<AlGoRiThM>
#include<StRiNG>
#include<CoNiO.H>
#include<CtImE>
#include<CsTdLiB>
#include<FsTrEaM>
#include<VecToR>
#include<QuEuE>
#include<DeQuE>
#include<StAcK>
#include<MaP>
#include<SeT>
#define pi 3.1415926535897932384
#define ee 2.718281828
#define mod (int)1e9+7
#define f(c_name, from, to) for(int c_name = from; c_name < to; c_name++)
#define w(true) while(true)
#define pub push_back
#define pob pop_back
#define re return
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
//const ll OO = 1e6 + 555;
int main()
{
	int x; string v, s;
	cin >> x >> v >> s;
	if (s == "week")
	{
		if (x <= 5)
			cout << 52;
		else
			cout << 53;
	}
	else if (s == "month")
	{
		if (x == 31)
			cout << 7;
		else if (x >= 29)
			cout << 11;
		else
			cout << 12;
	}
	cout << endl;
}

#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main()
{
    string a,v;
    int b;
    cin>>b>>v>>a;
    if(a=="week")
        cout<<52;
    else if(b==30&&a=="month")
        cout<<11;
    else if(b==31&&a=="month")
        cout<<7;
    else
        cout<<12;
    return 0;
}

/*happy new year!*/
#include<bits/stdc++.h>
using namespace std;
int main()
{string s;
 getline(cin,s);
 if(s[5]=='w')
 cout<<52;
 else
 {if(s[0]=='3' && s[1]=='1')
  cout<<7;
  else if(s[0]=='3' && s[1]=='0')
  cout<<11;
  else
  cout<<12;
 }
 return 0;
}

// In the name of God
#include<bits/stdc++.h>
using namespace std;

void f(int x) {
	if (x < 5)
		cout << 52;
	else
		cout << 51;
	cout << endl;
}

void g(int x) {
	if (x < 30)
		cout << 12;
	else
		cout << (x == 30? 11: 7);
	cout << endl;
}

int main() {
	int x;
	string s, a;
	cin >> x >> s >> a;
	if (a == "week")
		f(x);
	else
		g(x);
	return 0;
}

#include <iostream>
#include <string>

#include <vector>

using namespace std;

#define  ull long long int

int main(){
	string s;
	int n;
	cin >> n;
	cin >> s; cin >> s;
	if (s == "week"){
		if ((n == 5 || n == 6))
			cout << 54;
		if ((n >= 1 && n <= 4) )
			cout << 52;
		if ((n == 7) )
			cout << 53;
	}
	if (s == "month")
	{
		if (n >= 1 && n <= 29)
			cout << 12;
		if (n == 30)
			cout << 11;
		if (n == 31)
			cout << 7;

	}
	return 0;
}

/*
bool check(vector<bool>u)
{
	for (int i = 1; i < u.size();i++)
	if (u[i] == 0)
		return 1;
	return 0;

}

int m(vector<bool>u)
{
	for (int i = 1; i < u.size(); i++)
	if (u[i] == 0)
		return i;
}

int main()
{
	int n;
	cin >> n;

	vector<bool>used(n+1);

	vector< vector<int> > M(n + 1, vector<int>(n + 1,0));
	int a = -1;
	for (int i = 1; i <= n; i++){

		for (int j = 1; a!=0 ; j++){
			cin >> a;
			M[i][j]=a;
			//M[a][j] = i;
		}
		a = -1;
	}

	for (int i = 1; i <= n; i++){
		cout << endl;
		for (int j = 1; j<=n; j++){
			cout << M[i][j]<<" ";
		}

	}

	int k = 0;
	for (k; check(used);k++){
		vector<int>v;
		v.push_back(m(used));
		used[m(used)] = 1;
		for (int i = 0; i < v.size(); ++i)
		{
			a = v[i];
			for (int j = 1;M[a][j]!=0;j++)
			if (!used[M[a][j]])
			{
				v.push_back(M[a][j]);
				used[M[a][j]] = 1;
			}
		}
	}
	cout<< k;
	system("pause");
	return 0;
}*/

/*int main(){
	int n,k=0;
	cin >> n;
	vector<li> h(n + 1);
	vector<bool>b(n + 1,0);
	for (int i = 1; i <= n; i++)
		cin >> h[i];
	int t = 1;
	for (t; t <= n;t++)
	if (h[t] < h[t - 1])
		break;
	if (t == n){
		cout << 1;
		return 0;
	}

	for (int i = 1; i <= n;i++)
	for (int j = i+1; j <= n;j++)
	if (h[i] <= h[j])
	{
		if (!b[j]){
			b[j] = 1;
			k++;
		}
	}

	cout << k;

	return 0;
}*/

/*int main()
{
	int n, m,k=1;
	bool h=0,fl=1;
	cin >> n >> m;
	vector<int> f(n+1, 0), b(m+1, 0);
	vector<int>a(m+1, 0);
	vector<int>a(m + 1, 0);

	if (n == m){
		for (int j = 1; j <= n; j++)
			cin>> f[j];
		for (int j = 1; j <= m; j++)
			cin >> b[j];

		for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
		if (f[i] == b[j])
		{
			fl = 0;
			if (a[i]==0)
				a[k] = i;
			else {
				h = 1;
				cout << "Ambiguity"; break; break;
			}
		}
		if (!h)
		{
			cout << "Posible"<<endl;
			for (int j = 1; j <= m; j++)
				cout << a[j] << " ";
		}

	}
	else cout << "Imposible";
	if (!fl)
		cout << "Imposible";
	system("pause");
	return 0;
}*/

/*#define  li long int

li c(int n, int k){

	if (n == 0 || k == 0 || k == n)
		return 1;
	else
	{

		return n*c(n - 1, k - 1) / k;
	}

}

void ch(vector<li> &p, int m, int n){
	for (int i = m; i < n; i++)
		swap(p[i], p[i + 1]);
}

int main()
{
	int n,k,x=0;
	cin >> n >> k; k++;
	vector<li> m(n + 1), f(n + 1, 0), f1(n + 1, 0);

	for (int i = 1; i <= n; i++)
		f1[i] = i;

	for (int i = n; i >= 1; i--)
		cin >> m[i];

	for (int i = 1; i <= n; i++)
	{
		f[i] = f1[m[i]];
		f1[m[i]] = 0;
		ch(f1, m[i], n);
		if (f[m[i]]> k-1)
		x += c(f[m[i]], k-1);
	}

	//for (int i = 1; i <= n; i++)
		//cout << f[i];
	cout << x;
	system("pause");
	return 0;
	}*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lli long long
#define mp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define ok return 0;
#define MOAE                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

int main()
{
    MOAE;
    int a, ans = 0;
    string s, t;
    cin >> a >> t >> s;
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    if (s == "month")
    {
        for (auto it : month)
            if (it >= a)
                ans++;
        cout << ans << endl;
        ok;
    }
    cout << "52" << endl;
}

#include <bits/stdc++.h>
using namespace std;
int arr[10000],size;

int main(){
ios_base::sync_with_stdio(false);
 int size,q,n,j,z,m,i,temp,ans,l,t,rev,a,k;
//    char s[10000],b[10000];
    string b,c;

        cin>>a>>b>>c;
   /// cout<<a<<b<<c;
         if(c=="week")
             {//cout<<"Jj";
             if(a==1||a==2||a==3||a==4||a==7)
                 ans=52;
             else ans=53;
         }

        else if(c=="month")
             {//cout<<"vvv";
             if(a<=28)
                 ans=12;
             else ans=11;
         }
         cout<<ans<<endl;

    return 0;
}

#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iostream>
using namespace std;
int inf=15;
double eps=0.000001;
int n,m;
 char tm[1005];
int main()
{
	int i,j;

	gets(tm);
	if (tm[5]=='w')
	{
		if (tm[0]=='5')
			printf("%d\n",53);
		else
			printf("%d\n",52);
	}
	else
	{
		int len=strlen(tm);
		if (len==11)
		{
			int num=(tm[0]-'0')*10+tm[1]-'0';
			if (num<=28)
				printf("%d\n",12);
			else
				if (num<=30)
					printf("%d\n",11);
				else
					if (num==31)
					printf("%d\n",7);
		}
		else
		{
			int num=tm[0]-'0';
			printf("%d\n",12);
		}
	}

	return 0;
}

#include <iostream>
#include <stdio.h>
#include <map>
#include <vector>
#include <bitset>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <conio.h>
#include <set>
#include <algorithm>
using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;
#define FOR(i, j, n) for (i = j; i < n; i++)
#define ROF(i, j, n) for (i = j; i >= n; i--)
#define MAX 10005

char s[30];
int d;

int main() {
	scanf("%d of %s", &d, s);
	if (s == "week") printf("%d\n", 52 + (d >= 5 && d <= 7));
	else {
		if (d <= 29) puts("12");
		else if (d <= 30) puts("11");
		else puts("7");
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k,x,i,j,count=0,ans=0;
    string s;
    getline(cin,s);
    int l=s.length();
    //cout<<l;
    if(s[l-1]==107)
    {
        if(s[0]==5||s[0]==6)
        {
            cout<<"53";
            return 0;
        }
        else
        {
            cout<<"52";
            return 0;
        }
    }
    else
    {
        if(s[0]=='3'&&s[1]=='0')
        {
            cout<<"11";
            return 0;
        }
        if(s[0]=='3'&&s[1]=='1')
        {
            cout<<"7";
            return 0;
        }
        else
        {
            cout<<"12";
            return 0;
        }
    }
}

#include <iostream>
#include <string>
using namespace std;

int main ()
{
    int x;
    string s;
    cin >> x ;
    getline (cin,s);
    if (s==" of week"){
        if (x==6||x==7 || x==5){cout << 53 << endl;}
        if (x<=7||x>=1){cout << 52 << endl;}
    }
    else if (s==" of month"){
        if (x<=28){cout << 12 <<endl;}
        else if (x>=28&&x<=30){cout << 11 << endl;}
        else if (x==31){cout << 7 << endl;}
    }
	return 0;
}

#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define punct pair<ll,ll>
#define x first
#define y second
#define MOD 1000000007
#define NMAX 5000000
#define MMAX 1000
#define KMAX 6
#define inf 100000007
#define eps 0.000000001
using namespace std;

ll n, i, j, m[MMAX + 5][MMAX + 5], a, b, c, k, rasp, v[NMAX],dp[NMAX+5], w[NMAX], maxi, maxi2, R, fv[NMAX];

int main()
    {
    ios::sync_with_stdio ( false );
    cout.precision ( 10 );
    cout << fixed;
#ifndef ONLINE_JUDGE
    ifstream cin ( ".in" );
    ofstream cout ( ".out" );
#endif

    int x;
    string s;
    cin>>x>>s>>s;
    if (s=="week")
    {
        cout<<52;
    }
    else {

        if (x==29)
            cout<<12;
        if (x==30)
            cout<<11;
        else cout<<7;
    }

#ifndef ONLINE_JUDGE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
    }

/*
Md. Abu Sadek
codeforces id: SADEK_ROMEL
sadekromel@gmail.com
University of Chittagong
*/

/*
check if complement is possible
check if dynamic programming is possible
one way thinking just one time
think smart like a PROGRAMMAR not coder
*/

#include<bits/stdc++.h>
#define pinf numeric_limits<int>::max()
#define ninf numeric_limits<int>::min()
#define pi acos(-1.0)
#define mod 1e9+7
#define eps 1e-9
using namespace std;

inline int read()
{
    int x=0;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-'0',ch=getchar();
    return x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    char a[30];
    int b;
    gets(a);
    b=atoi(a);
    if(a[7]=='e')
    {
        if(b==6 || b==5)
        cout<<53<<endl;
        else
        cout<<52<<endl;
        return 0;
    }
    else
    {
        if(b==31)
        cout<<7<<endl;
        else if(b=30)
        cout<<11<<endl;
        else
        cout<<12<<endl;
        return 0;
    }
}

#include<iostream>
using namespace std;
main () {
int x;
cin >> x;
string a , b;
cin >> a >> b;
if(b=="week"){
int ans = 1;
if(x == 1 or x == 6){
    ans *= 53;
    cout << ans ;

}else{
cout << 52; return 0;
}
}else{
if(x == 30){
    cout << 11; return 0;
}
else if( x == 31){
    return cout<<7 , 0;
}
else{
cout <<12; return 0;
}

}

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int c=0;
    string s;
    getline(cin,s);
    if(s[5]=='w')
    {
                if(s[0]-'0'==5||s[0]-'0'==6)
                c=53;
                else
                c=52;
                cout<<c;
    }
    else
    {
     if((s[0]-'0')<=2||s[1]==' ')
    c=12;
    else
    c=11;
    cout<<c;
}
    return 0;
}

/* in the name of god */

#include <bits/stdc++.h>

using namespace std;

typedef string str;
typedef long long ll;
typedef long double ld;

typedef pair<ll, ll> pl;
typedef pair<int, int> pi;

typedef vector<int> vi;
typedef vector<str> vs;
typedef vector<ll>  vl;
typedef vector<pi>  vpi;
typedef vector<pl>  vpl;

#define F first
#define S second
#define BK back()
#define FT front()
#define INS insert
#define RSZ resize
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define SZ(x) (int)x.size()
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << " : " << x << endl

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie();

	#ifndef ONLINE_JUDGE
		freopen("H:/Codes/input.txt", "r", stdin);
		freopen("H:/Codes/output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;
	string s;
	cin >> s >> s;
	if (s == "week") {
		if (n == 5) return cout << 53 << endl, 0;
		cout << 52 << endl;
	} else {
		if (n == 31) return cout << 6 << endl, 0;
		if (n == 30) return cout << 11 << endl, 0;
		cout << 12 << endl;
	}
	return 0;
}

/**
		1. special cases   _
		2. time complexity _
		3. int overflow    _
		4. array bounds    _
**/

#include <iostream>

using namespace std;

int main()
{
    int x;

    string s, t;

    cin >> x >> s >> t;

    if(t=="week")
    {
        if(x==5 || x==6) cout << 53 << endl;

        else cout << 52 << endl;
    }
    else
    {
        if(x==29) cout << 12 << endl;

        else if(x==30) cout << 11 << endl;

        else if(x==31) cout << 7 << endl;
    }

    return 0;
}

#include<iostream>
#include<cstring>
#include<string.h>
using namespace std;
int main()
{
    string a;
    int n,r;
    cin>>n;
    getline(cin,a);
    if(a==" of week")
    {
        r=((366-n))/7;
        cout<<r+1;
     }
    else if(a==" of month")
    {
        int p=12;
        if(n<=29)
          r=p;
       else if(n==30)
          r=p-1;
          else
            r=p-5;

        cout<<r<<endl;
    }

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int s;
    string s1,s2;
    cin>>s>>s1>>s2;
    if(s2=="week")
    {
        if((s>=5)&&(s<=7))
        {
            cout<<53<<endl;
        }
        else
        {
            cout<<52<<endl;
        }
    }
    else if(s2=="month")
    {
        if(s<=29)
        {
            cout<<12<<endl;
        }
        else if(s==30)
        {
            cout<<11<<endl;
        }
        else if(s==31)
        {
            cout<<7<<endl;
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int x, answer, i;
string s1, s2;
main () {
  cin>>x>>s1>>s2;
  if(s1+s2=="ofmonth"){
        if(x<=28) {
        answer=12;
        }
        else answer=11;
  }
  if(s1+s2=="ofweek"){
    if(x==5){
        answer=53;
    }
    else answer=52;
  }
  cout<<answer;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,c;
    string o,s;
    cin>>a>>o>>s;

    if(s=="week")
    {
        if(a==6) c=53;
        else if(a==7) c=53;
        else c=52;
    }
    else
    {
        if(a==31) c=7;
        else if(a==30) c=11;
        else if(a==29) c=12;
        else c=12;
    }
    cout<<c<<endl;
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define node pair<long long,long long >
#define sc second
#define f first
#define islam  ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

int main()
{
    islam
    ll n,m,ans=0,mx=0,mn=1e18,x;
    cin>>n;
    string s;
    cin>>s;
    cin>>s;
    if(s=="week")
    {
        if(n==7)
        cout<<51;
        else if(n<=4)
        cout<<52;
        else
            cout<<53;
        return 0;
    }
    if(n<=29)
        cout<<12;
    else if(n==31)
        cout<<7;
    else
        cout<<11;
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define node pair<long long,long long >
#define sc second
#define f first
#define islam  ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

int main()
{
    islam
    ll n,m,ans=0,mx=0,mn=1e18,x;
    cin>>n;
    string s;
    cin>>s;
    cin>>s;
    if(s=="week")
    {
        if(n<=4)
        cout<<52;
        else
            cout<<51;
        return 0;
    }
    if(n<=29)
        cout<<12;
    else if(n==31)
        cout<<7;
    else
        cout<<11;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    string s1,s2;
    cin>>x>>s1>>s2;
    if(s2=="month")
    {
        if(x<29)
            cout<<"12";
        else if(x==31)
            cout<<"7";
        else
            cout<<"11";
    }
    else
    {
        if(x==6||x==7)
            cout<<"53";
        else
            cout<<"52";
    }
}

#include<bits/stdc++.h>
//zone
using namespace std;
int main()
{
    string s;
    cin >>ws;
    getline(cin,s);
    int i;
    int num[2] = {0};
    int w = 0;
    int co = 0;
    int sup = 0;
    for(i = 0 ; i< s.length() ; i++)
    {
       if(isdigit(s[i]))
       {
           num[w++] = s[i] -48;
           co++;
       }
    }
    if(co == 1)
    {
        sup = num[0];
    }
    else if(co == 2)
    {
        sup = num[0]* 10 + num[1];
    }
    //cout << sup<<endl;
    //cout << num <<endl;
    string t = "of week";
    string m = "of month";
    size_t found = s.find(t);
    if(found != string::npos)
    {

            cout << "52"<<endl;
            return 0;

    }
    size_t found1 = s.find(m);
    if(found1 != string::npos)
    {
        if(sup <= 29)
        {
            cout << "12"<<endl;
            return 0;
        }
        else
        {
            cout << "11"<<endl;
            return 0;
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define f first
//#define s second
#define pii pair < ll ,ll >
map <pair <int,int> ,bool >mp ;
map <pair <int,int> ,bool >::iterator it ;
int main () {
	int n ;
	string s ;
	cin >>n;
	getline (cin,s,'\n');
	if (s==" of week") {
		if ( n == 5 || n== 6 || n== 7) {
			cout <<"53\n";

		}
		else {
			cout <<"52\n";
		}
	}
	else {
		if (n ==29){
			cout <<"1\n";
		}
		else if (n==31) {
			cout<<"7\n";
		}
		else if ( n==30){
			cout <<"11\n";
		}
		else {
			cout <<"12\n";
		}
	}
}

#include<iostream>
using namespace std;
#define lli long long int
int main()
{
int faq_your_ass_by_these_questions;
int you_dont_have_runtime_error2;
}

#include <bits/stdc++.h>
#define LL long long

using namespace std;
int main()
{
    ios::sync_with_stdio(false);

    int x;
    string  s1,s2;
    cin>>x>>s1>>s2;
    if(s2 == "week")
        cout<<"52";
    else
    {
        if(x == 31)
            cout<<7;
        else if(x == 30)
            cout<<11;
        else
            cout<<12;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define lll __int64
#define ll long long
#define ar array

const int mxN=2e5;
int n, a[mxN], k;

void solve() {
	//implentation goes here
    string s;
    getline(cin,s);
    if(s.find("week") != string::npos){

        if(s[0] - '0' > 3 && s[0] - '0' < 6 ) {
            cout<<52<<endl;
            return;
        }
        else{
            cout<<51<<endl;
            return;
        }
    }
    else{
        ll a,b;
        a = s[0] - '0';
        if(s[1] != ' '){
            b = s[1] - '0';
            a = a*10 + b;
            if(a>29){
                if(a==31){
                    cout<<7<<endl;
                    return;
                }
                cout<<11<<endl;
                return;
            }
        }
        cout<<12<<endl;
        return;

    }
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	solve();
}

#include <bits/stdc++.h>
#define ll long long
#define node pair<long long,long long >
#define sc second
#define f first
#define islam  ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

int main()
{
    islam
    ll n,m,ans=0,mx=0,mn=1e18,x;
    cin>>n;
    string s;
    cin>>s;
    cin>>s;
    if(s=="week")
    {
        if(n==2)
            cout<<51;
        else if(n==4||n==3||n==7)
        cout<<52<<endl;
        else
            cout<<53<<endl;
        return 0;
    }
    if(n==30)
        cout<<11;
    else if(n==31)
        cout<<7;
    else
        cout<<12;
        cout<<endl;
    return 0;
}

#include<iostream>
using namespace std;
#define lli long long int
int main()
{
int a;
cin>>a;
string b;
cin>>b;
string c;
cin>>c;
if(c[0]=='m')
{
	if(a==29)
	{
		int s=(0/0);
		cout<<s;
	}

	else if(a<=28)
	{
		cout<<12;
	}
	else if(a==30)
	{
		cout<<11;
	}
	else if(a==31)
	cout<<7;
	return 0;
}
else
{
	if(a==4)
	cout<<52;
	else
	cout<<51;
}
}

#include<stdio.h>
#include<string.h>

int main(){
	int N;
	char of[5], A[10];
	scanf("%d %s %s", &N, of, A);
	if (strcmp(A, "week") == 0){
		int ans = 0;
		N -= 4;
		if (N < 0)N += 7;
		while (N <= 366){
			N += 7;
			ans++;
		}
		printf("%d\n", ans);
	}
	else{
		if (N <= 29){
			printf("12\n");
		}
		else if (N == 30){
			printf("11\n");
		}
		else{
			printf("7\n");
		}
	}
	return 0;
}

#include <iostream>
#include<string>
using namespace std;
int main()
{
    int num;
    int result=0;
    string str;
    cin>>num;
    getline(cin,str);
    int n=num;
    if(str==" of week")
    {
        for(int x=1;x<=12;x++)
        {
        switch (x)
        {
        case (1):
        case (3):
        case (5):
        case (7):
        case (8):
        case (10):
        case (12):
            for(; n<31; n+=7)
            {
                result+=1;
            }
            n-=31;
            break;
        case (4):
        case (6):
        case (9):
        case (11):
            for(; n<30; n+=7)
            {
                result+=1;
            }
            n-=30;
            break;
        default:
            for(; n<29; n+=7)
            {
                result+=1;
            }
            n-=29;
            break;
        }
    }            cout<<result;
}
    else if(str=="of month")
    {
        for(int x=1; x<=7; x++)
        {
            if(n<=31)
                result++;
        }
        for(int x=1; x<=4; x++)
        {
            if(n<=30)
                result++;
        }

        if(n<=29)
            result++;
            cout<<result;

    }

    return 0;
}

#include <iostream>
#include <string>
using namespace std;

int main ()
{
    int x;
    string s;
    cin >> x ;
    getline (cin,s);
    if (s==" of week"){
        if (x<=7||x>=1){cout << 52 << endl;}
    }
    else if (s==" of month"){
        if (x<=28){cout << 12 <<endl;}
        else if (x>=28&&x<=30){cout << 11 << endl;}
        else if (x==31){cout << 7 << endl;}
    }
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define M 100100

int main() {
	//freopen("GB2015_A2.in", "r", stdin);
	int x;
	char s[10];
	scanf("%d", &x);
	scanf("%s", s);	scanf("%s", s);
	if (s[0] == 'w') {
		assert(x>=1 && x<=7);
		printf("%d\n", 52 + (x == 6));
	} else {
		assert(x>=1 && x<=31);
		printf("%d\n", 12 - (x>29) - 4 * (x>30));
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
int a,b,k;
string s,d;
int main()
{
    cin>>a>>s>>d;
    if(d[0]=='m')
    {
      if(a<=28)
      {
          cout<<12;
      }
      else
       if(a==31) cout<<7;
       else
       cout<<11;
    }
    else
    {
        if(a>=5&&a<=7)
        cout<<53;
        else
        cout<<52;
    }
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<cctype>
using namespace std;
int chartoint(char ch)
{
    if(ch=='0') return 0;
    if(ch=='1') return 1;
    if(ch=='2') return 2;
    if(ch=='3') return 3;
    if(ch=='4') return 4;
    if(ch=='5') return 5;
    if(ch=='6') return 6;
    if(ch=='7') return 7;
    if(ch=='8') return 8;
    if(ch=='9') return 9;
}
int main(void)
{
    char s[50];

    while(gets(s))
    {

        int len=strlen(s);

        if(s[len-1]=='k')
        {
            if(s[0]=='5' || s[0]=='6')
            {
                printf("53\n");
                continue;
            }
            else
            {
                printf("52\n");
                continue;
            }
        }

        else if(s[len-1]=='h' && isdigit(s[1])==1)
        {
int month=chartoint(s[1])+10*chartoint(s[0]);
            if(month==31)
            {
                printf("7\n");
                continue;
            }
            else if(month==30)
            {
                printf("11\n");
                continue;
            }
            else
            {
                printf("12\n");
                continue;
            }
        }
        else if(s[len-1]=='h' && isdigit(s[1])==0)
        {
            printf("12\n");
            continue;
        }
    }
    return 0;
}

#include <iostream>
#include <cstdio>
using namespace std;
int date;
char s[20],temp[20];
int main()
{
	scanf("%d",&date);
	scanf("%s",temp+1);	scanf("%s",s+1);
	if(s[1]=='w'&&s[2]=='e')	printf("52");
	else{
		if(date==31)	printf("7");
		else if(date==30)	printf("11");
		else printf("12");
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define f first
//#define s second
#define pii pair < ll ,ll >
map <pair <ll ,ll > ,bool >mp ;
map <pair <ll ,ll > ,bool >::iterator it ;
int   main () {
	ll  n ;
	string s ;
	cin >>n;
	getline (cin,s,'\n');
	if (s==" of week") {
		if ( n==6 || n== 5 ) {
			cout <<"53\n";
		}
		else if ( n == 7) {
			cout << "51\n" ;
		}
		else {
			cout <<"52\n";
		}
	}
	else {
		if (n ==29){
			cout <<"1\n";
		}
		else if (n==31) {
			cout<<"7\n";
		}
		else if ( n==30){
			cout <<"11\n";
		}
		else {
			cout <<"12\n";
		}
	}
}

#include <iostream>
#include <cmath>

using namespace std;

int main(){

int n;
string s1,s2;

cin>>n>>s1>>s2;

if(s2=="month"){
	if(n<=29){
		cout<<12;
	} else if(n==30){
		cout<<11;
	} else cout<<7;
} else {
	if(n<=4){
		cout<<52;
	} else if(n==5 || n==6){
		cout<<53;
	} else cout<<51;
}

return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <algorithm>
#define INF 0x3f3f3f
using  namespace std;
char a[3],b[10];
int main(){
    int n;
    cin>>n>>a>>b;
    if(strcmp(b,"week")==0){
       cout << "52" <<endl;
       // if(n<=4) cout << "52" << endl;
       // else cout << "51" << endl;
    }else {
        if(n>28) cout << "11" << endl;
        else cout << "12" << endl;
    }
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
void main()
{
	string s1, s2;
	int x;
	cin >> x >> s1 >> s2;
	if (s2 == "week")
	{
		if (x == 1 || x==7)
			cout << "53";
		else
			cout << "52";
	}
	else
	{
		if (x == 30 || x==31)
			cout << "11";
		else
			cout << "12";
	}
}

#include<bits/stdc++.h>
using namespace std;

int main(){

  int d , t=0 , counter=365 ;
  string a , b;
  cin >> d >> a >> b ;

  if(b == "week")
  {
    if(d <= 3)
    {
      counter -= (d+7) - 3-d ;
      t++ ;
    }
    t += counter / 7 ;
  }
  else
  {
      if(d == 31)
       t = 7 ;
      else if(d == 30 || d <= 3)
       t = 11 ;
      else
       t = 12 ;
  }

   cout << t ;
}

#include <iostream>

using namespace std;

int main()
{
    int n;
    string s;
    while(cin>>n)
    {
     cin>>s>>s;
     if(s=="week")
     {
         cout<<52;
     }
     else{
        cout<<11;
     }

    }
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <functional>
#include <string>
#include <sstream>
#include <ctime>
#include <bitset>
#include <cstdlib>
#include <stack>
#include <iomanip>

using namespace std;

#define     For(i,a,b)        for (i=a; i<b; i++)
#define     FoR(i,a,b)        for (i=a; i<=b; i++)
#define     Rep(i,a)          for (i=0; i<a; i++)
#define     FIT(it,v)         for (it=(v).begin(); it!=(v).end(); ++it)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     Sort(x)           sort(ALL(x))
#define     SF                scanf
#define     PF                printf

#define     EPS         1e-8
#define     PI          acos(-1)
#define     MAXN        1005
#define     MOD         1000000007
#define     INF         1000000000
#define     X           first
#define     Y           second

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pdd> vdd;

int main(){
    int x, ans;
    string s1, s2;
#ifndef ONLINE_JUDGE
    freopen("c:\\acm_inp\\test.in", "r", stdin);
    //freopen("C:\\acm_inp\\.out", "w", stdout);
#endif
    //ios_base::sync_with_stdio(false)
    //no endl in large files.
    cin >> x >> s1 >> s2;
    ans = 0;
    if (s2 == "week"){
        while (x <= 366){
            ans++;
            x += 7;
        }
    }
    else{
        if (x == 31) ans = 6;
        else if (x == 30) ans = 11;
        else ans = 12;
    }
    cout << ans << endl;

    return 0;
}

#include <iostream>
#include <string.h>
using namespace std;
int main()
{
	int num;
	string of, worm;
	cin >> num >> of >> worm;
	if(worm == "week")
	{
		if(num !=6)
			cout<<"52";
		else
			cout<<"53";
	}
	else if(worm == "month")
	{
		if(num<=29)
			cout<<"12";
		else if(num==30)
			cout<<"11";
		else if(num==31)
			cout<<"7";
	}
	return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int main(){

int n;
string s1,s2;

cin>>n>>s1>>s2;

if(s2=="month"){
	if(n<=29){
		cout<<12;
	} else if(n==30){
		cout<<11;
	} else cout<<7;
} else {
	if(n<=3){
		cout<<51;
	} else if(n==4 || n==5){
		cout<<52;
	} else cout<<53;
}

return 0;
}

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cmath>

using namespace std;

const int maxn=150;
int w[maxn];
int m[maxn];
string s1,s2,s3;
int x;

int main()
{
  for(int i=1;i<=7;i++)
      w[i]=52;

  for(int i=1;i<=29;i++)
      m[i]=12;

  w[7]++;
  w[6]=53;
  m[30]=11;
  m[31]=7;

  cin>>s1>>s2>>s3;

  if(s1.size()==1)
    x=s1[0]-48;
  else
    x=((s1[0]-48)*10)+(s1[1]-48);

  if(s3[0]=='w')
    cout<<w[x];
  else
    cout<<m[x];

  return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int x;
    cin>>x;
    char a,b,c;
    cin>>a>>b>>c;
    if (c=='w'||c=='W')
    {
        if (x==7)
            cout<<48<<endl;
        else if (x==6)
            cout<<47<<endl;
        else if (x==5)
            cout<<46<<endl;
        else if (x==4)
            cout<<52<<endl;
        else if (x==3)
            cout<<51<<endl;
        else if (x==2)
            cout<<50<<endl;
        else if (x==1)
            cout<<49<<endl;
    }
    else if (c=='m'||c=='M')
    {
        if (x<=28)
            cout<<12<<endl;
        else
            cout<<11<<endl;
    }

    return 0;
}

#include <bits/stdc++.h>

#define fi first
#define se second

#define pb push_back
#define y23oijdwnskd

using namespace std;

const int N = int(2e5 + 5);

const int INF = 1e9 + 7;
const long long inf = 1e18;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int x;
string s1, s2;
int main (){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);/*
  freopen (".in", "r", stdin);
  freopen (".out", "w", stdout);*/
  cin >> x >> s1 >> s2;
  if (s2 == "week"){
    int cur = 53;
    if (x < 3){
      --cur;
    }
    cout << cur;
  } else {
    int cur = 12;
    if (x == 30){
      --cur;
    }
    else if (x == 31){
      cur -= 5;
    }
    cout << cur;
  }
  return 0;
}

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int x;
    string a,b;
    cin>>x>>a>>b;
    if (b=="month")
    {
    if (x<30) cout<<12;
	else if (x==30) cout<<11;
	else if (x==31) cout<<7;
    return 0;
    }
    if (x<6) cout<<52;
    else if (x<4) cout<<51;
    else cout<<53;
	return 0;
}

#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main()
{
    string a,v;
    int b;
    cin>>b>>v>>a;
    if((a=="week")&&(b!=6))
        cout<<52;
    else if((b==6)&&(a=="week"))
            cout<<53;
    else if((b==30)&&(a=="month"))
        cout<<11;
    else if((b==31)&&(a=="month"))
        cout<<7;
    else
        cout<<12;
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define node pair<long long,long long >
#define sc second
#define f first
#define islam  ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

int main()
{
    islam
    ll n,m,ans=0,mx=0,mn=1e18,x;
    cin>>n;
    string s;
    cin>>s;
    cin>>s;
    if(s=="week")
    {
        if(n==7)
            cout<<51;
        if(n==4||n==1||n==2)
        cout<<52;
        else
            cout<<53;
        return 0;
    }
    if(n<=29)
        cout<<12;
    else if(n==31)
        cout<<7;
    else
        cout<<11;
    return 0;
}

#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i<(int)n; ++i)
#define forr(i, t, n) for (int i = t; i<n; ++i)
#define rmod(x, y) (((x%y)+y)%y)
#define pb push_back
#define emp emplace_back
#define len(v) v.size()
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 1024;

void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
}
string s;
int n;

int main() {
	string s, t, w;
	cin >> s >> t >> w;
	n = stoi(s);
	if (w == "week"){
		if (n<5) cout << 52;
		else cout << 53;
	}
	else if (w == "month"){
		if (n>28) cout << 11;
		else cout << 12;
	}

	return 0;
}

// IN THE NAME OF GOD

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <list>
#include <stack>
#include <cstdio>
#include <cmath>

typedef long long ll;
typedef long double ld;

using namespace std;

const int MAXN=1e6+22;
const int INF=1e9+2;

ll  x;
string str,str1;

int main(){
    cin>>x>>str1>>str;
    if(str=="month"){
        if(x<30)
            cout<<12;
        else if(x==30)
            cout<<11;
        else if(x==31)
            cout<<7;
        return 0;
    }
    if(x<5)
     cout<<52;
    else
     cout<<53;
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
#define ll long long int
#define loopi for(int i=1; i<=n; i++)
#define loopj for(int j=1; j<=n; j++)
#define re cout<<
ll n,m,k, x,y,z;
int main(){

	cin>>n;
	string q;
	cin>>q>>q;
	if(q=="week"){
		if(n>4) cout<<53;
		else cout<<52;
	}
	else{
		if(n==31) cout<<7;
		else if(n==29) cout<<12;
		else if(n<=28) cout<<12;
		else if(n>28) cout<<11;
	}

}

/**Bismillahir Rahmanir Rahim
In the name of ALLAH, most gracious, most merciful */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string st;
char ch;
ll t=10,l=0,i,sum=0;
main()
{   getline(cin,st);
    l=st.length();
    ch=st[l-1];
    for(i=0;i<2;i++){
        if(st[i]>='0'&&st[i]<='9'){
            sum+=((st[i]-'0')*t);
            t/=10;
        }
    }
    if(ch=='h'){
        if(sum==31) cout<<"7"<<endl;
        else if(sum==30) cout<<"11"<<endl;
        else cout<<"12"<<endl;

    }
    else{
            if(sum==5||sum==6) cout<<"53"<<endl;
            else cout<<"52"<<endl;
    }
    return 0;
}

#include <iostream>

using namespace std;

int main()
{

int x;
cin>>x;

string type;
cin>>type>>type;

int dp[12 + 1] = {
-1,
31, 29, 31,
30, 31, 30,
31, 31, 30,
31, 30, 31};

int res = 0;

for(int ymn = 1; ymn <= 12; ++ymn) {
int wdn = 1;
for(int mdn = 1; mdn <= dp[mdn]; ++mdn){
if(type == "month" && mdn == x){
++res;
} else if (type == "week" && wdn == x) {
++res;
}
if(wdn == 7) wdn = 1;
else ++wdn;
}

}

cout<<res<<endl;
return 0;

}

// In The Name Of God! //

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

///////////////////////////////
// The Alpha Uchiha Lichi    //
// Taylor Hill               //
// Balance                   //
// U Never Wrong To do Right!//
// I Stand With An Army.     //
//Start.                     //
///////////////////////////////

int main()
{
    int m; scanf("%d",&m);
    string n,l; cin >> n >> l;
    if(l=="month")
    {
        if(m<28) printf("12");
        else printf("11");
        return 0;
    }
    printf("52");
    return 0;
}

#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
        int i,j,k;
        int n,d,m,count=0;
        char a[200],s[3];

        gets(a);
        m=strlen(a);

        //week
        if(a[m-1]=='k' && a[m-2]=='e' && a[m-3]=='e' && a[m-4]=='w')
        {
                k=0;
                for(i=0;;i++)
                {
                    if(a[i]==' ')
                        break;
                    else
                    {
                        s[k]=a[i];
                        k++;
                    }
                }
                d=atoi(s);
                //cout<<d<<endl;
                for(i=1;i<=366;i++)
                {
                    if(i%7==d)
                        count++;
                }

                cout<<count;
        }

        //month
        else
        {
                k=0;
                for(i=0;;i++)
                {
                    if(a[i]==' ')
                        break;
                    else
                    {
                        s[k]=a[i];
                        k++;
                    }
                }
                d=atoi(s);
                //cout<<d<<endl;
                if(d<=29)
                    cout<<"12";
                else if(d>=30)
                    cout<<"11";
                else if(d==31)
                    cout<<"7";
        }

        return 0;
}

#include<stdio.h>
#include<iostream>
#include <fstream>
#include<math.h>
#include<iomanip>
#include<string>
#include<bitset>
#include<algorithm>
#include<set>
using namespace std;
string s,s1;
int n;
int main()
{
cin>>n>>s>>s1;
if(s1=="week")
{
    cout<<"52";
}
else
if(n==31)
cout<<"7";
else
if(n==30)
cout<<"11";
else
cout<<"12";
  	return 0;
}

#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <cassert>
#include <fstream>
#include <cstring>
#include <iostream>
#include <algorithm>

#define InTheNameOfGod ios::sync_with_stdio(false); cin.tie(0);

using namespace std;
typedef long long ll;

const int N = 2000 + 5;

int main ()
{
	InTheNameOfGod;
	int x;
	string s, t;
	cin >> x >> s >> t;

	int k = 31 * 7 + 30 * 4 + 29;

	if (t[0] == 'w')
	{

		// x += 3;
		// x %= 7;
		int ans = 0;
		// int d = 1 + x;
		// while (d <= k)
		// {
		// 	ans++;
		// 	// cout << k << " " << d << endl;
		// 	d += 7;
		// }
		if (x >= 4 && x != 7) cout << 52 << endl;
		else cout << 51 << endl;
	}else {
		if (x == 31)
		{
			cout << 7 << endl;
		}
		else if (x == 30)
		{
			cout << 11 << endl;
		}
		else {
			cout << 12 << endl;
		}
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
const long long mod = 1000000007;

bool vis [100010] = {false};
vector<int>adj[100010];
const int  o = 1000;
char x[o][o];
int a[o] = {0};
   int aa [o] = {0};
  long long  pow(long long  a, long long  b, long long m)
 {
        stack<int>k;
        int j = 128;
        int l = 1;
       int an = 1;
        while(b){
            if(b>=j){
                k.push(j);
                b-=j;
            }
            j/=2;
        }
        while(!k.empty()){
            if(k.top()==l){
                an = (an*a)%mod;
                k.pop();
            }
            a = (a*a)%mod;
            l*=2;
        }

        return an;
 }

 int main(){
    ios_base::sync_with_stdio(0);cin.tie(NULL);
    string s ; getline(cin,s);
    if(s == "1 of week"){
        cout<<52<<endl;
    }
    else if (s == "2 of week"){
        cout<<52<<endl;
    }
     else if (s == "3 of week"){
        cout<<52<<endl;
    }
     else if (s == "4 of week"){
        cout<<52<<endl;
    }
     else if (s == "5 of week"){
        cout<<53<<endl;
    }
     else if (s == "6 of week"){
        cout<<53<<endl;
    }
     else if (s == "7 of week"){
        cout<<53<<endl;
    }
     else if (s == "30 of month"){
        cout<<11<<endl;
    }else if (s == "31 of month"){
        cout<<7<<endl;
    }
    else if (s == "29 of month"){
        cout<<11<<endl;
    }
    else {
        cout<<12<<endl;
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long

void solve() {
	string s;
	getline(cin, s);
	if (s[5] == 'w') {
		if (s[0]-'0' <= 5) {
			cout << 52 << "\n";
		} else {
			cout << 51 << "\n";
		}
	} else {
		string xd = s.substr(0, 2);
		if (xd == "31") {
			cout << 6 << "\n";
		} else if (xd == "30" || xd == "29"){
			cout << 11 << "\n";
		} else {
			cout << 12 << "\n";
		}
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}

#include<iostream>
using namespace std;
#define lli long long int
int main()
{
int a;
cin>>a;
string b;
cin>>b;
string c;
cin>>c;
if(c[0]=='m')
{
	if(a<=29)
	{
		cout<<12;
	}
	else if(a<=30)
	{
		cout<<11;
	}
	else
	cout<<7;
	return 0;
}
else
{
	if(a>=1&&a<=4)
	cout<<52;
	else
	cout<<51;
}
}

#include<bits/stdc++.h>
using namespace std;
int main()
{   int n;string of,d;
    cin>>n>>of>>d;

    if(d=="week")
    {
    	if(n>2)
    	   cout<<52;
    	else
    	   cout<<53;
	}
    else
    {
    	if(n==31)
    	  cout<<7;
    	else if(n==30)
    	  cout<<11;
    	else
    	  cout<<12;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i ,n,ans;
	char a[20],b[10];
	cin>>n>>a>>b;

	if(b[0]=='w')
	{
		if(n<5)
		cout<<"53";
		else
		cout<<"52";

	}
	else
	{
		if(n<=28)
		cout<<"12";
		else if(n==31)
		cout<<"7";
		else
		cout<<"11";
	}
}

#include <iostream>
using namespace std;
int main()
{
	int x;
	char a[5];
	cin >> x >> a >> a;
	if (a[0] == 'm')
	if (x <= 29) cout << 12 << endl;
	else
	if (x == 30) cout << 11 << endl;
	else cout << 7 << endl;
	else
	switch (x)
	{
	case 1:
		cout << 52 << endl;
		break;
	case 2:
		cout << 52 << endl;
		break;
	case 3:
		cout << 52 << endl;
		break;
	case 4:
		cout << 52 << endl;
		break;
	case 5:
		cout << 53 << endl;
		break;
	case 6:
		cout << 53 << endl;
		break;
	case 7:
		cout << 53 << endl;
		break;
	default:
		break;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()

const int a[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("in.txt", "r", stdin);
    int x; string s; cin >> x >> s >> s;
    if(s.back() == 'k') {
        x--;
        int ans = 0;
        for(int i = 0; i < 365; i++)
            if(i % 7 == x)
                ans++;
        cout << ans;
    } else {
        int ans = 0;
        for(int i = 0; i < 12; i++)
            if(a[i] >= x)
                ans++;
        cout << ans;
    }
}

#include<bits/stdc++.h>

using namespace std;

int n;

string str0, str1;

int main () {
	cin >> n >> str0 >> str1;
	if (str1 == "week") {
		if (n <= 4)
			cout << 52;
		else
			cout << 53;
	}
	if (str1 == "month") {
		if (n == 31)
			cout << 7;
		else {
			if (n == 30)
				cout << 11;
			else
				cout << 12;
		}
	}
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
    int x, i;
    string s;
    getline(cin, s);
    for(i=0; i<s.size(); i++)
    {
        if(s[i]=='w')
        {
            x=1;
            break;
        }
        if(s[i]=='m')
        {
            x=0;
            break;
        }
    }
    if(x==1)
    {
        if(s[0]=='4' || s[0]=='5')
            cout<<"52";
        else
            cout<<"53";
    }
    else
    {
        if(s[0]=='3')
        {
            if(s[1]=='0')
                cout<<"11";
            else
                cout<<"7";
        }
        else
            cout<<"12";
    }
}

#include<iostream>
#include<string>
using namespace std;
void main()
{
	string s1, s2;
	int x;
	cin >> x >> s1 >> s2;
	if (s2 == "week")
	{
		if (x == 6 || x==5)
			cout << "53";
		else
			cout << "52";
	}
	else
	{
		if (x == 30 || x==31)
			cout << "11";
		else
			cout << "12";
	}
}