Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.

Limak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year 2016.

Limak wants to prove how responsible a bear he is. He is going to regularly save candies for the entire year 2016! He considers various saving plans. He can save one candy either on some fixed day of the week or on some fixed day of the month.

Limak chose one particular plan. He isn't sure how many candies he will save in the 2016 with his plan. Please, calculate it and tell him.


-----Input-----

The only line of the input is in one of the following two formats:   "x of week" where x (1 ≤ x ≤ 7) denotes the day of the week. The 1-st day is Monday and the 7-th one is Sunday.  "x of month" where x (1 ≤ x ≤ 31) denotes the day of the month. 


-----Output-----

Print one integer — the number of candies Limak will save in the year 2016.


-----Examples-----
Input
4 of week

Output
52

Input
30 of month

Output
11



-----Note-----

Polar bears use the Gregorian calendar. It is the most common calendar and you likely use it too. You can read about it on Wikipedia if you want to – https://en.wikipedia.org/wiki/Gregorian_calendar. The week starts with Monday.

In the first sample Limak wants to save one candy on each Thursday (the 4-th day of the week). There are 52 Thursdays in the 2016. Thus, he will save 52 candies in total.

In the second sample Limak wants to save one candy on the 30-th day of each month. There is the 30-th day in exactly 11 months in the 2016 — all months but February. It means that Limak will save 11 candies in total.

Difficulty: interview

Starter code:

Solutions:
x = input().split(' ')
if x[-1] == "month":
    if x[0] == '31':
        print(7)
    elif x[0] == '30':
        print(11)
    else:
        print(12)
else:
    if x[0] in ['5', '6']:
        print(53)
    else:
        print(52)

p=input().split()
if p[2]=='week':
    x=int(p[0])
    if x==5 or x==6:
        print(53)
    else:
        print(52)
else:
    x=int(p[0])
    if x<=29:
        print(12)
    elif x==30:
        print(11)
    else:
        print(7)


data = list(input().split())
if data[2] == "week":
    if data[0] == "5" or data[0] == "6":
        print(53)
    else:
        print(52)
else:
    if int(data[0]) <= 29:
        print(12)
    elif data[0] == "30":
        print(11)
    else:
        print(7)

s = input().split()
M = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if (s[-1] == 'month'):
    x = int(s[0])
    ans = 0
    for i in range(12):
        if (M[i] >= x):
            ans += 1
    print(ans)
else:
    x = int(s[0])
    cur = 5
    ans = 0
    for i in range(366):
        if (cur == x):
            ans += 1
        cur += 1
        cur = (cur - 1) % 7 + 1
    print(ans)


ch = str(input())
n = len(ch)
t = ch[n-1]
e = ch.index(" ")
m = int(ch[:e])
if t == "k":
    if m == 5 or m == 6:
        print(53)
    else:
        print(52)
else:
    if m <= 29:
        print(12)
    elif m == 30:
        print(11)
    elif m == 31:
        print(7)


3

mnthnums = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def of_month(n):
    ans = 0
    for i in range(12):
        if mnthnums[i] >= n:
            ans += 1
    return ans


def of_week(n):
    if n >= 5:
        n -= 4
    else:
        n += 2
    return (366 - n + 7) // 7


strs = input().split()
n = int(strs[0])

if strs[-1] == "week":
    print(of_week(n))
else:
    print(of_month(n))


#!/usr/bin/env python3
line = input().split()
n = int(line[0])
if line[2] == 'month':
    if n == 31:
        print(7)
    elif n == 30:
        print(11)
    else:
        print(12)
else:
    if n == 5 or n == 6:
        print(53)
    else:
        print(52)


blah = input().split()
if blah[2] == "week":
    if blah[0] == "5" or blah[0] == "6":
        print(53)
    else:
        print(52)
else:
    if blah[0] == "31":
        print(7)
    elif blah[0] == "30":
        print(11)
    else:
        print(12)


args = input().split()

num = int(args[0])

if args[2] == 'month':
    if num <= 29:
        print(12)
    elif num == 30:
        print(11)
    else:
        print(7)
else:
    if (num == 5) or (num == 6):
        print(53)
    else:
        print(52)

__author__ = 'Utena'
n=input().split()
if n[2]=='week':
    n=int(n[0])
    if n==5 or n==6:
        print(53)
    else:print(52)
else:
    n=int(n[0])
    total=0
    for i in range(1,13):
        if i in (1,3,5,7,8,10,12):
            total+=1
        elif i in(4,6,9,11):
            if n<=30:total+=1
        else:
            if n<=29:total+=1
    print(total)

import datetime

ans = 0
x, *s = input().split()
cur = datetime.date(2016, 1, 1)
while cur.year != 2017:
    if s == ["of", "week"]:
        ans += (cur.isoweekday() == int(x))
    else:
        ans += (cur.day == int(x))
    cur += datetime.timedelta(1)
print(ans)


import itertools
import math

s = input().split()
n = int(s[0])
i = (s[2] == 'week')
if i:
    print(366//7 + (5 <= n <= 6))
else:
    if n <= 29:
        print(12)
    elif n == 30:
        print(11)
    else:
        print(7)


sent = input().split()
x = int(sent[0])

if sent[-1] == 'week':
    if x in [5, 6]:
        print(53)
    else:
        print(52)
else:
    if x == 31:
        print(7)
    elif x == 30:
        print(11)
    else:
        print(12)


a = list(input().split())
if a[2] == 'month':
    if a[0] == '31':
        print(7)
    elif a[0] == '30':
        print(11)
    else:
        print(12)
else:
    if a[0] == '5' or a[0] == '6':
        print(53)
    else:
        print(52)


import datetime

a, b, c = input().split()
a = int(a)
ans = 0
for i in range(1, 13):
    for s in range(1, 32):
        try:
            x = datetime.datetime(2016, i, s)
            if c == 'week' and x.weekday() == a - 1:
                ans += 1
            if c == 'month' and s == a:
                ans += 1
        except:
            pass
print(ans)


x = input().split()
n = int(x[0])
if x[2] == "week":
	if n == 5 or n == 6:
		print(53)
	else:
		print(52)
else:
	if n<30:
		print(12)
	elif n == 30:
		print(11)
	else:
		print(7)


import datetime

d = datetime.date(2016, 1, 1)
v = input().split()

ans = 0

while True:
    if d.year != 2016:
        break
    if v[2] == 'week' and int(v[0]) == d.isoweekday():
        ans += 1
    if v[2] == 'month' and int(v[0]) == d.day:
        ans += 1
    d = d + datetime.timedelta(days=1)

print(ans)



a = list(map(str, input().split()))
a[0] = int(a[0])
if a[2] == 'month':
    if a[0] <= 29:
        print(12)
    elif a[0] == 30:
        print(11)
    else:
        print(7)
else:
    if a[0] >= 5 and a[0] != 7:
        print(53)
    else:
        print(52)


l = list(map(str, input().split()))
if l[2] == 'month':
    if int(l[0]) <= 29:
        print(12)
    if int(l[0]) == 30:
        print(11)
    if int(l[0]) == 31:
        print(7)
else:
    x = int(l[0])
    if x >= 1 and x <= 4 or x == 7:
        print(52)
    if x == 5 or x == 6:
        print(53)

#import sys

#sys.stdin = open('input.txt')
#sys.stdout = open('output.txt', 'w')

s = input().split()
num = int(s[0])

if s[-1] == 'week':
    if num in (5, 6):
        print(53)
    else:
        print(52)
else:
    if num < 30:
        print(12)
    elif num == 30:
        print(11)
    elif num == 31:
        print(7)

a, b, c = map(str, input().split())
a = int(a)
if (c == "month"):
    if (a < 30):
        print(12)
    elif(a==30):
        print(11)
    else:
        print(7)
else:
    arr = [52, 52, 52, 52, 53, 53, 52]
    print(arr[a-1])

a = input().split()
if a[2] == 'month':
    print(12 - (int(a[0]) >= 30) - 4 * (int(a[0]) == 31))
else:
    print(53 if int(a[0]) in (5, 6) else 52)


import datetime
cur = datetime.date(2016, 1, 1)
day = datetime.timedelta(days=1)

l = input().split()
hit = int(l[0])
assert l[2] in ["week", 'month']
month = l[2] == "month"

tot = 0
while cur.year == 2016:
    if month:
        if cur.day == hit: tot += 1
    else:
        if cur.isoweekday() == hit: tot += 1
    cur += day
print(tot)


inp = input().split()
if inp[2] == "week":
    ans = 51
    if inp[0] in "567":
        ans += 1
    if inp[0] in "123456":
        ans += 1
    print(ans)
else:
    x = int(inp[0])
    ans = 7
    if x <= 29:
        ans += 1
    if x <= 30:
        ans += 4
    print(ans)

IN = input().split()

day = int(IN[0])
if IN[2] == 'week':
    if day==5 or day==6: print('53')
    else: print('52')
else: # month
    if day<30: print('12')
    elif day<31: print('11')
    else: print('7')