uses math;
const
        maxc=1000000000+69;
        modulo=1000000000+7;
        w:array[1..7] of longint=(52,52,52,52,53,53,52);
        m:array[1..12] of longint=(31,29,31,30,31,30,31,31,30,31,30,31);

type
        re=record
                x,y:longint;
        end;

var
        n,res:longint;
        s:string;

procedure mofile;
begin
        assign(input,'');
        reset(input);
        assign(output,'');
        rewrite(output);
end;

procedure dongfile;
begin
        close(input);
        close(output);
end;

procedure nhapdl;
var
        i:longint;
begin
        read(n);
        readln(s);
        if length(s)=8 then writeln(w[n]) else
        begin
                res:=0;
                for i:=1 to 12 do
                if n<=m[i] then
                begin
                        inc(res);
                end;
                writeln(res);
        end;
end;

begin
        mofile;
        nhapdl;
        dongfile;
end.

program z1;
var x,i:integer;a:string;
begin
read(x,a);
if a=' of week' then
case x of
1,2,3,4,7:write('52');
5,6:write('53');
end;
if a=' of month' then case x of
1..29:write('12');
30:write('11');
31:write('7');

end;
end.

var a,b:array[1..2000] of longint;
i,j,n,m,k,max,q:longint;
a1,a2,a3,a4,s2:int64;
s,s1:string;
	begin
	read(s);
	n:=pos(' ',s);
	k:=pos('w',s);
	s1:=copy(s,1,n-1);
	val(s1,n);
	if k=0 then
		begin
		if n=31 then write(7) else
		if n=30 then write(11) else
		write(12);
		end else
		begin
		if (n<5) or (n=7) then write(52) else write(53);
		end;
	end.

var i,k,n,m,l:longint;
    ch:char;
    s:string;
  begin
   readln(n,ch,s);
   if s[4]='w' then
    begin
     if (n=5) or (n=6) then WriteLn(53) else WriteLn(52);
    end;
   if s[4]='m' then
    begin
     if (n<30) then WriteLn(12) else
     if (n=30) then WriteLn(11) else
     if (n=31) then WriteLn(7);
     end;
  end.

{$mode objfpc}
var
 s:ansistring;
 res,date:int64;

procedure input;
begin
 read(s);
end;

procedure solvemonth;
begin
 if s[2]=' ' then res:=12
  else
   begin
    date:=(ord(s[1])-48)*10+ord(s[2])-48;
    if (10<=date) and (date<=29) then res:=12;
    if date=30 then res:=11;
    if date=31 then res:=7;
   end;
end;

procedure solveweek;
begin
 case s[1] of
  '1':res:=52;
  '2':res:=52;
  '3':res:=52;
  '4':res:=52;
  '5':res:=53;
  '6':res:=53;
  '7':res:=52;
 end;
end;

procedure output;
begin
 write(res);
end;
begin
 input;
 if s[length(s)]='h' then solvemonth else solveweek;
 output;
end.

uses sysutils;
var
s:string;
z:longint;
begin
readln(s);
if(pos(' of month',s)<>0) then
begin
if(s[2]=' ') then delete(s,2,length(s)-1);
delete(s,3,length(s)-2);
z:=strtoint(s);
if(z=31) then writeln(7)
else
if(z=30) then writeln(11)
else
writeln(12);
end;
if(pos(' of week',s)<>0) then
begin
delete(s,2,length(s)-1);
z:=strtoint(s);
if(z=0) then writeln(0);
if(z=1) then writeln(52);
if(z=2) then writeln(52);
if(z=3) then writeln(52);
if(z=4) then writeln(52);
if(z=5) then writeln(53);
if(z=6) then writeln(53);
if(z=7) then writeln(52);
end;
end.

var n,ans:word;
s:string;
begin
read(n);
readln(s);

if pos('week',s)=0 then begin
  if n <30 then ans:=12 else
  if n=30 then ans:=11 else ans:=7;
end else
if (n=5) or (n=6) then ans:=53 else ans:=52;
write(ans);
end.

var
  cur,s:string;
 i,ans, a, n: integer;
  procedure week(a:byte);
   Begin
     if (a=6)or(a=5) then Writeln(53) else Writeln(52);
   end;
  procedure month(a:byte);
   begin
    if a=30 then Writeln(11);
    if a=31 then Writeln(7);
    IF a<30 then Writeln(12);
   end;
begin
 read(a); Readln(s);
 n:=pos('week',s);
 if n=0 then month(a) else
  week(a);
end.

program A_611;

var
  n:longint;
  s:string;

begin
  read(n);
  read(s);
  if s[5]='w'
    then case n of
      5,6:write('53');
      1..4,7:write('52');
    end
    else case n of
      31:write('7');
      30:write('11');
      1..29:write('12');
    end;
end.

var i,n,lik,kod,kol,t:longint;
s,l:string;
a,b:array [0..1000] of longint;
begin
b[1]:=31;
b[2]:=29;
b[3]:=31;
b[4]:=30;
b[5]:=31;
b[6]:=30;
b[7]:=31;
b[8]:=31;
b[9]:=30;
b[10]:=31;
b[11]:=30;
b[12]:=31;

readln(s);
if (s[2]=' ') then begin l:=s[1];delete(s,1,2);end else
begin l:=s[1]+s[2];delete(s,1,3);end;
val(l,lik,kod);
t:=4;
for i:=1 to 366 do
begin
inc(t);
a[i]:=t;
if (t>=7) then t:=0;
end;
if (s='of week') then
begin
for i:=1 to 366 do
if (a[i]=lik) then inc(kol);
end else
if (s='of month') then
begin
for i:=1 to 12 do
begin
if(b[i]>=lik) then inc(kol);

end;

end;
writeln(kol);
end.

var s:string;
    x,i,ans:longint;
begin
read(s);
val(copy(s,1,pos(' ',s)-1),x,ans);
delete(s,1,pos(' ',s));
if s='of week'
   then  if (x=5) or (x=6) then ans:=53 else ans:=52
   else  if x<30 then ans:=12
                 else if x=30 then ans:=11
                              else ans:=7;
write(ans);
end.

{$MODE OBJFPC}
var    a,i:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=5) or (a=6) then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) then writeln(11) else
          if a=31 then writeln(7) else writeln(12)
end.

var n,i,j,k:longint;
    a,b,c,d:char;
    s:string;
begin
  readln(n,a,b,c,d,s);
  if s='week' then
    begin
      if n=7 then
        begin
          writeln('52');
        end
      else if n=1 then
        begin
          writeln('52');
        end
      else if (n=2) or (n=3) or (n=4) then
        begin
          writeln('52');
        end
      else if (n=5) or (n=6) then
        begin
          writeln('53');
        end;

    end
  else
    begin
      if n<=29 then
        writeln('12')
      else if n=30 then
        writeln('11')
      else if n=31 then
        writeln('7');
    end;
end.

const
        month:array[1..12] of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
        week:array['0'..'9'] of longint=(0,1,2,3,4,5,6,7,8,9);

var
        s:string;
        ans,i:longint;

procedure find1(x:longint);
var
        i,j,weekday:longint;
begin
        weekday:=5;
        for i:=1 to 366 do
        begin
                if weekday=x then inc(ans);
                inc(weekday);
                if weekday=8 then weekday:=1;
        end;
end;

procedure find2;
var
        i,j,da:longint;
begin
        i:=1; da:=0;
        while s[i]<>' ' do
        begin
                da:=da*10+week[s[i]];
                inc(i);
        end;
        for i:=1 to 12 do
                for j:=1 to month[i] do
                        if da=j then inc(ans);
end;

begin
        readln(s);
        for i:=1 to length(s) do
        begin
                if s[i]='w' then find1(week[s[1]]);
                if s[i]='m' then find2;
        end;
        write(ans);
end.

var n:longInt;
    s:string;
Begin
   ReadLn(n,s);
   if(s=' of week')then
     begin
      if(n=1)then Write(52)
      else if(n=2)then Write(52)
      else if(n=3)then Write(52)
      else if(n=4)then Write(52)
      else if(n=5)then Write(53)
      else if(n=6)then Write(53)
      else if(n=7)then Write(52);
     end
   else
    begin
      if(n=31)then Write(7)
      else if(n=30)then Write(11)
      else Write(12)
    end;
End.

{$mode objfpc}
const ztrong = 'sub trong contest ko AC, chep code hai ha';
var
 s:ansistring;
 res,date:int64;
 hihi, haha, huhu, hehe: integer;

procedure DealWithmonth;
begin
 if s[2]=' ' then res:=12
  else
   begin
    date:=(ord(s[1])-48)*10+ord(s[2])-48;
    if (10<=date) and (date<=29) then res:=12;
    if date=30 then res:=11;
    if date=31 then res:=7;
   end;
end;

procedure DealWithWeek;
begin
 case s[1] of
  '1':res:=52;
  '2':res:=52;
  '3':res:=52;
  '4':res:=52;
  '5':res:=53;
  '6':res:=53;
  '7':res:=52;
 end;
end;

begin
 read(s);
 if s[length(s)]='h' then dealwithmonth else DeaLWitHweek;
 writeln(res);
end.

uses
  sysutils;

var
  option: Byte;
  day: Integer;
  str: String;
  i: Byte;
  temp: Byte;

BEGIN
  ReadLn(str);

  if Pos('of week', str) <> 0 then
    begin
      day := StrToInt(str[1]);
      option := 1;
    end;

  if Pos('of month', str) <> 0 then
    begin
      i := 1;
      temp := 1;
      while str[i] <> ' ' do
        begin
          day := temp * day + StrToInt(str[i]);
          temp := temp * 10;
          inc(i);
        end;
      option := 2;
    end;

  Case option of
    1 : begin
          if (day >= 1) and (day <= 4) then WriteLn('52');
          if (day >= 5) and (day <= 6) then WriteLn('53');
          if day = 7 then WriteLn('52');
        end;
    2 : begin
          if (day >= 1) and (day <= 29) then WriteLn('12');
          if day = 30 then WriteLn('11');
          if day = 31 then WriteLn('7');
        end;
  end;
END.

var
  a, t : longint;
  s : string;
begin
  readln(a, s);
  if s[length(s)] = 'h' then
    begin
      if a <= 29 then t := 12 else
      if a = 30 then t := 11 else
      if a = 31 then t := 7;
    end else
  if s[length(s)] = 'k' then
    begin
      t := 52;
      if (a = 5) or (a = 6) then inc(t);
    end;
  writeln(t);
end.

program ex611a;
var x,k:integer;
s:string;
begin
read (x);
readln (s);
if s=' of week' then
case x of
1,2,3,4,7 : k:=52;
5,6 : k:=53;
end;
if s=' of month' then
case x of
1..29 : k:=12;
30 : k:=11;
31 : k:=7;
end;
writeln (k);
end.

var k,n:byte;
       s:string;
begin
read(k,s);
if pos('w',s)<>0 then begin
if k<5 then write(52) else
if k<7 then write(53) else write(52);
end else
begin
if k<30 then write(12) else
if k=30 then write(11) else
write(7);
end;
end.

var
	x,y:string;
	n:integer;

begin
	readln(n,x);
	if pos('of month', x)>0 then
	begin
		if n<=29 then writeln('12')
			else if n=30 then writeln('11')
				else if n=31 then writeln('7');
	end else if pos('of week', x)>0 then
	begin
		if ((n=6)or(n=5)) then writeln('53')
			else writeln('52');
	end;
end.

program zzz;
const
  FirstDay = 5;
  LastDay = 6;
  Months: array [1..12] of byte = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var
  s: ansistring;
  x, i, kol: byte;
begin
  read(s);
  x := 0;
  i := 1;
  while (s[i] <> ' ') and (i <= Length(s)) do
  begin
    x := x * 10 + Ord(s[i]) - Ord('0');
    inc(i);
  end;
  kol := 0;
  case s[Length(s)] of
  'h': for i := 1 to 12 do
         if x <= Months[i] then inc(kol);
  'k': if (x < FirstDay) or (x > LastDay)
       then kol := 52
       else kol := 53;
  end;
  write(kol);
end.

{$mode objfpc}
{$coperators on}
{$macro on}
uses math,sysutils;
const
     fin   ='';//p611a.inp';
     fou   ='';
     maxn = 366;
     base = trunc(1e9)+7;
type
     pair = record
          fi,se     :longint;
     end;
     tag  = record
          day,date  :longint;
     end;
var
     n              :longint=365;
     a              :array[0..maxn] of tag;
     s              :string;
     k1,k2          :array[0..31] of longint;
     maxdate        :array[0..12] of longint=(31,31,29,31,30,31,30,31,31,30,31,30,31);
procedure enter;
begin
     readln(s);
end;

procedure init;
var
     i,j,c            :longint;
begin
     a[0].day:=3; a[0].date:=31;
     j:=1;
     c:=1;
     for i:=1 to 366 do
     begin
          a[i].day:=(a[i-1].day+1) mod 7;
          k1[a[i].day+1]+=1;
          a[i].date:=c;
          c+=1;
          k2[a[i].date]+=1;
          if a[i].date=maxdate[j] then
          begin
               j+=1;
               c:=1;
          end;
     end;
end;
procedure solve;
var
     x,typ            :string;
     i,num            :longint;
begin
     init;
     i:=length(s);
     while s[i]<>' ' do
     begin
          typ:=s[i]+typ;
          i-=1;
     end;
     x:=copy(s,1,pos(' ',s)-1);
     num:=strtoint(x);
     if typ[1]='m'  then writeln(k2[num])
     else writeln(k1[num]);
end;

BEGIN
     assign(input,fin);   reset(input);
     assign(output,fou);  rewrite(output);

     enter;
     solve;

     close(input);
     close(output);
END.

var
 n,m,k,l,w,j:longint;
 s:string;
begin
 read(n);
 readln(s);
 if s[length(s)]='k' then
 begin
  l:=5;
  while k<366 do
  begin
   inc(k);
   if l=n then inc(w);
   inc(l);
   if l=8 then l:=1;
  end;
  writeln(w);
 end else
 begin
  if n<=29 then writeln(12) else
  if n=30 then writeln(11) else
  if n=31 then writeln(7);
 end;
end.

Program solu;
Var
  Ch:string;
  N,e:longint;
Begin
  Readln(ch);
  If ch[length(ch)]='k' then
  Begin
    Val(copy(ch,1,length(ch)-8),n,e);
    Case n of
    5,6: write(53);
    1..4: write(52);
    7: write(52)
    Else write(0);
    End;
  End
  Else if(ch[length(ch)]='h') then
         Begin
             Val(copy(ch,1,length(ch)-9),n,e);
             Case n of
             1..29: write(12);
             30: write(11);
             31: write(7)
             Else write(0);end;
             End
          Else write(0);
End.

{$MODE OBJFPC}
var
  m, n: Integer;
  st: String;
begin
  ReadLn(m, st);
  n := Length(st);
  if st = ' of week' then
    if (m <> 5) and (m <> 6) then WriteLn('52') else WriteLn('53');
  if st = ' of month' then
    if m <= 29 then WriteLn('12') else
      if m = 30 then WriteLn('11') else
        if m = 31 then WriteLn('7');
end.

var
  s:string;
  i,code,data,data2,q:integer;
begin
  read(s);
  q:=length(s);
  if s[q]='h'
    then
      if s[2] in ['0'..'9']
        then begin
               val(s[1],data,code);
               data:=data*10;
               val(s[2],data2,code);
               data:=data+data2;
             end
        else val(s[1],data,code);

  if (data<>30) and (data<>31) and (data<>0) and (s[q]='h')
    then begin
           writeln ('12');
           exit;
         end
    else
      if (data=30) and(s[q]='h')
        then begin
               writeln ('11');
               exit;
        end
        else
         if (data=31) and (s[q]='h')
         then begin
                writeln ('7');
                exit;
              end;
  val(s[1], data,code);
  if ((data=6) or (data=5))
   then  writeln('53')
   else if (data=2)
      then  writeln('52')
      else if ((data=1) or (data=3) or (data=4) or (data=7))
           then writeln('52')

end.

var
a:array [1..7] of longint;
b:array [1..31] of longint;
i,k,ss,k1:longint;
s,s1:string;
begin
for i:=1 to 4 do a[i]:=52;
a[5]:=53; a[6]:=53;
a[7]:=52;
for i:=1 to 29 do
b[i]:=12;
b[31]:=7;
b[30]:=11;
readln (s);
k:=pos(' ',s);
s1:=copy(s,1,k-1);
val(s1,ss,k1);
delete(s,1,k);
if s='of week' then writeln (a[ss])
else writeln (b[ss]);
end.

const fi    ='GoodBye2015_A.inp';
      fo    ='GoodBye2015_A.out';

var   s     :string;
      i,num :longint;
begin
      read(s);
      i:=1;
      while (i<=length(s)) and (s[i]>='0') and (s[i]<='9') do
      begin
            num:=num*10+ord(s[i])-48;
            inc(i);
      end;
      if pos('month',s)<>0 then
      begin
            if num<=29 then write(12);
            if num=30 then write(11);
            if num=31 then write(7);
            if num>31 then write(0);
      end else
      begin
            if num>7 then write(0) else write((366-9) div 7+ord(num>=5)+ord(num<=6));
      end;
end.

const
  {$ifdef online_judge}
  fi='';fo='';
  {$else}
  fi='test.inp';fo='test.out';
  {$endif}
var
  x:longint;
  s:string;
begin
  assign(input,fi);reset(input);
  assign(output,fo);rewrite(output);
  read(x);
  read(s);
  delete(s,1,4);
  If s[1]='w' then
    case x of
      5,6:write(53)
    else write(52);
    end
  else
    case x of
      30:write(11);
      31:write(7)
    else write(12);
    end;
end.

    var
		m, n: int64;
		s, s1: string;

    begin

		readln(s);
		for var i := 1 to s.length do
		begin
			if (s[i] = ' ') then
				break;
			s1 += s[i];
		end;

		if (pos('w', s) > 0) then
		begin
			if (StrToInt(s1) = 6) or (StrToInt(s1) = 5) then
				writeln(53)
			else
				writeln(52);
		end
		else begin
			if (StrToInt(s1) <= 29) then
				writeln(12);
			if (StrToInt(s1) = 31) then
				writeln(7);
			if (StrToInt(s1) > 29) and (StrToInt(s1) <= 30) then
				writeln(11);
		end;

    end.

program ProjectA;

{$APPTYPE CONSOLE}

uses
  SysUtils,  Math;

var
g,f,k:integer;
s:string;
begin
 readln(s);
 val(copy(s,1,2),g,f);
 k:=0;
 if s[2]=' ' then
 begin
   if copy(s,6,4)='week' then inc(k);
 end
 else
 begin
   if copy(s,7,4)='week' then inc(k);
 end;
 if k=0 then
 begin
   if g=30 then writeln(11);
   if g=31 then writeln(7)  ;
   if g<=29 then writeln(12) ;
 end
 else
 begin
   if (g=5) or (g=6)then writeln(53)
   else writeln(52);
 end;

  readln;
end.

program Limak;
var mode: string;
sweets, tmp: integer;
begin
read(tmp);
readln(mode);
if (mode = ' of week')
  then if (tmp > 4) and (tmp < 7) then sweets := 53 else sweets := 52
  else if (tmp < 30) then sweets := 12 else if (tmp < 31) then sweets := 11 else sweets := 7;
writeln(sweets);
end.

Program Mishka;
Var
    x:Integer;
    s:String;
Begin
    read(x, s);
    if (s[5] = 'w') then
        begin
            if ((x = 5) or (x = 6)) then
                begin
                    x := 53;
                end
            else
                x := 52;
        end;
    if (s[5] = 'm') then
        begin
            if x <= 29 then
                x := 12;
            if x = 30 then
                x := 11;
            if x = 31 then
                x := 7;
        end;
    writeln(x);
    Readln;
 End.

const d:array[1..7] of longint=(52,52,52,52,53,53,52);
var a:longint;
    o:string;
    c:char;
begin
  readln(a,c,c,c,c,o);
  if o[1]='w' then writeln(d[a]) else
     if a<=29 then writeln(12) else
     if a= 30 then writeln(11) else
                   writeln(7);
end.

program Project1;

{$APPTYPE CONSOLE}
{$O-}
uses
  SysUtils;
var
  s : string;
  c : char;
  w, m : boolean;
  n : longint;
begin
  {assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output); }
  while not eoln do
  begin
    read(c);
    if c = ' ' then
    begin
      n := strtoint(s);
      s := '';
      read(c);
      read(c);
      read(c);
      read(c);
    end;
    if c = 'm' then
    begin
      m := true;
      Break;
    end;
    if c = 'w' then
    begin
      w := true;
      break;
    end;
    s := s + c;
  end;
  if (w) then
  begin
    if n = 1 then
    begin
      writeln(52);
      halt;
    end;
    if n = 2 then
    begin
      writeln(52);
      halt;
    end;
    if n = 3 then
    begin
      writeln(52);
      halt;
    end;
    if n = 4 then
    begin
      writeln(52);
      halt;
    end;
    if n = 5 then
    begin
      writeln(53);
      halt;
    end;
    if n = 6 then
    begin
      writeln(53);
      halt;
    end;
    if n = 7 then
    begin
      writeln(52);
      halt;
    end;
  end;
  if (m) then
  begin
    if n = 30 then
    begin
      writeln(11);
      halt;
    end;
    if n = 31 then
    begin
      writeln(7);
      halt;
    end;
    writeln(12);
  end;
end.

program Project151215;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Math;
type
  mass=array[1..201000]of Longint;
var
  n,x,y,dx,dy,k,sx,sy,i,j,l,r,v:Longint;
  m:mass;    flag:Boolean;
  a,b,c:int64;
  s:string;

begin
 // Reset(Input,'input.txt');
 // Rewrite(output,'output.txt');

  read(n);

  read(s);

  if  s[Length(s)] = 'k'
  then if (n = 6)or(n=5)
       then write(53)
       else write(52)
  else if n<=29
       then write(12)
       else if n<=30
            then write(11)
            else write(7);
end.

program ex;
var s:string;
begin
read(s);
if length(s)=9 then if ((ord(s[1])-48)<=4) or ((ord(s[1])-48)=7) then writeln(52) else writeln(53)
 else if (ord(s[1])-48=3) and (ord(s[2])=48) then writeln(11) else if (ord(s[1])=51) and (ord(s[2])=49) then writeln(7) else writeln(12);
end.

const
        fi='';
        fo='';
        maxc=1000000000;
        week:array[1..7] of longint=(52,52,52,52,53,53,52);
{-------------------------}
procedure openfiles;
begin
        assign(input,fi);
        reset(input);
        assign(output,fo);
        rewrite(output);
end;
{------------------------}
procedure closefiles;
begin
        close(input);
        close(output);
end;
{-------------------------}
procedure nhap;
var
        x:longint;
        s:string;
begin
        read(x);
        readln(s);
        if pos('week',s)<>0 then
        begin
                writeln(week[x]);
                exit;
        end;
        if x<=29 then
        begin
                writeln(12); exit;
        end;
        if x=30 then
        begin
                writeln(11); exit;
        end;
        if x=31 then
        begin
                writeln(7);exit;
        end;

end;
{-------------------------}
BEGIN
        openfiles;
        nhap;

        closefiles;
END.

Var a:array[1..10000] of longint ; S,S1,S2: string ; k,n,i,j,a1,b1,code : longint ;
begin
for i:=1 to 12 do
a[i]:=0 ;
a[1]:=31 ;
a[2]:=29 ;
a[3]:=31 ;
a[4]:=30 ;
a[5]:=31 ;
a[6]:=30 ;
a[7]:=31 ;
a[8]:=31 ;
a[9]:=30 ;
a[10]:=31 ;
a[11]:=30 ;
a[12]:=31 ;

readln(S) ;
for i:=1 to length(S) do begin
if S[i]=' 'then break ;
S1:=S1+S[i] ;
end ;
for i:=length(S) downto 1  do begin
if S[i]=' ' then break ;
S2:=S2+S[i] ;
end ;
b1:=52 ;
val(S1,a1,code) ;

if S2='htnom' then  begin
for i:=1 to 12 do
if a[i]>=a1  then k:=k+1 ;
end ;
if S2='keew' then begin
if ( a1=5) or (a1=6) then k:=b1+1 else
k:=b1 ;
end ;
writeln(k) ;
end.

var sl,s:string; t:integer;
begin
 readln(sl);
 if (sl[1] in ['1' .. '9']) and (sl[2] in ['0' ..'9']) then
  begin
   s:=sl[1] + sl[2];
   val(s,t);
  end
   else val(sl[1],t);
 if pos('week',sl) <> 0 then
  begin
   inc(t);
   if (t = 6) or (t = 7 ) then write('53')
    else write('52');
  end
   else
    begin
     if t = 30 then begin write('11'); exit; end;
     if t = 31 then begin write('7'); exit; end;
     write('12');
    end;
end.

uses math;
var s,p:string; n:integer;
procedure Find;
var i,c:integer; t:string;
begin
   i:=1; t:='';
   while s[i]<>' ' do begin t:=t+s[i]; inc(i); end;
   val(t,n,c); delete(s,1,i+3);
   p:=s;
end;
BEGIN
   readln(s);
   Find;
   if p='month' then
      begin
         if n=31 then write('7') else
         if (n=30) then write('11') else
         write('12');
      end
   else
   begin
      if (n=5) or (n=6) then write('53')
      else write('52');
   end;
END.

program cf611A;
var x,rez:longint;
    s:string;
begin
readln(x,s);
if s[length(s)]='h' then
        begin
        if x<=29 then
                rez:=12
        else
                if x<=30 then
                        rez:=11
                else
                        rez:=7;
        end
else
        begin
        if (x=5) or (x=6) then
                rez:=53
        else
                rez:=52;
        end;
writeln(rez);
end.

var n,i:longint;
    s:ansistring;
    a:array[1..33] of longint;
  begin
    read(n);
    readln(s);
    for i:=1 to 29 do
      a[i]:=12;
    a[30]:=11;
    a[31]:=7;
    if s=' of week' then begin
                           if (n<>5) and (n<>6) then writeln(52)
                                                else writeln(53);
                         end
    else writeln(a[n]);
end.

{$MODE OBJFPC}
Var s : ansistring;
    tmp1,tmp2,tmp,res : Integer;
begin
  readln(s);
  val(s[1],tmp1);
  If (ord(s[2]) >= 48) and (ord(s[2]) <= 57) then
  val(s[2],tmp2) else tmp2 := -1;
  //writeln(tmp1,tmp2);
  If tmp2 <> -1 then tmp:= tmp1*10 + tmp2
  else tmp := tmp1;
  //writeln(tmp);
  If s[length(s)] = 'k' then
    begin
      If (tmp = 5) or (tmp = 6) then res:= 53
      else res:= 52;
    end;
  If s[length(s)] = 'h' then
    begin
      If tmp = 30 then res:= 11;
      If tmp = 31 then res:= 7;
      If tmp <= 29 then res:= 12;
    end;
  writeln(res);
end.

Var n,i:longint;
    s:ansistring;
    a:array[1..33] of longint;
  begin
    read(n);
    readln(s);
    for i:=1 to 29 do
      a[i]:=12;
    a[30]:=11;
    a[31]:=7;
    if s=' of week' then begin
                           if n=1 then writeln(52);
                           if n=2 then writeln(52);
                           if n=3 then writeln(52);
                           if n=5 then writeln(53);
                           if n=7 then writeln(52);
                           if n=6 then writeln(53);
                           if n=4 then writeln(52);
                         end
    else writeln(a[n]);
  end.

uses    math;
const   finp='';
        fout='';
var     fi,fo:text;
        s:string;
        n,i:longint;

BEGIN
        assign(fi,finp);reset(fi);
        assign(fo,fout);rewrite(fo);
        readln(fi,s);
        i:=1; n:=0;
        while s[i] in ['0'..'9'] do
         begin
                n:=n*10+ord(s[i])-48;
                inc(i);
         end;
        i:=i-1;
        if length(s)-i=8 then
         begin
                if (n=5) or (n=6) then writeln(fo,53) else writeln(fo,52);
         end else
         begin
                if n=30 then writeln(fo,11) else
                if n=31 then writeln(fo,7) else
                writeln(fo,12);
         end;
        close(fi);close(fo);
END.

program sum_delit;
const MES:array[1..12] of byte=(31,29,31,30,31,30,31,31,30,31,30,31);
var
  k,kl,d,kol,i:longint;
  st,z:string;
begin
  {Assign(input,'input.txt');
  Reset(input);
  Assign(output,'output.txt');
  Rewrite(output);}

  readln(st);

  k:=pos(' ',st); z:=copy(st,1,k-1);
  delete(st,1,k); val(z,d,kl);

  if st='of week' then begin
   if (d=5)or(d=6) then writeln(53)
   else writeln(52);
  end;

  if st='of month' then begin
   kol:=0;
   for i:=1 to 12 do
    if d<=mes[i] then inc(kol);

   writeln(kol);
  end;

//Close(input); Close(output);
end.

Var x : integer;
    s : string;

Begin
    read(x);
    read(s);
    if s[length(s)] = 'h' then
    Begin
        if x = 31 then writeln(7)
            else
        if x = 30  then writeln(11)
            else writeln(12);
    end;

    if s[length(s)] = 'k' then
    Begin
        if (x = 5) or (x = 6) then writeln(53)
            else writeln(52);
    end;
end.

Const Finp = '';
      Fout = '';
Var d:Byte;
    lc:Char;
Procedure Nhap;
Var f:Text;
    i:Byte;
    s,tmp:String;
Begin
    Assign(f,finp); Reset(f);
    Readln(f,s); tmp:='';
    For i:=1 to length(s) do
        If s[i] in ['0'..'9'] then
            tmp:=tmp+s[i]
        Else
        If s[i] = 'm' then lc:='m'
        Else
        If s[i] = 'w' then lc:='w';
    Val(tmp,d,i);
    Close(f);
End;
Function Week:Longint;
Begin
    If (d = 5) or (d = 6) then exit(53);
    exit(52);
End;
Function Year:Longint;
Begin
    If d <= 29 then exit(12);
    If d <= 30 then exit(11);
    exit(7);
End;
Procedure Xuat;
Var f:Text;
Begin
    Assign(f,fout); Rewrite(f);
    If lc = 'w' then write(f,week) else write(f,year);
    Close(f);
End;
Begin
    Nhap;
    Xuat;
End.

const
  fi='a.inp';
  fo='a.out';
  maxn=369;
var
  a : array[1..369] of longint;
  s : string;
  num,i,dem : longint;
begin
 // assign(input,fi);reset(input);
//  assign(output,fo);rewrite(output);
  read(num);
  read(s);
  a[1] := 5;
  for i := 2 to 366 do
  begin
    a[i] := (a[i-1] + 1) mod 8;
    if a[i] = 0 then a[i] := 1;
  end;
  if s = ' of week' then
    begin
      for i := 1 to 366 do
        if a[i] = num then inc(dem);
      writeln(dem);
    end
    else
    begin
      if num <30 then writeln(12) else
      if num =30 then writeln(11) else writeln(7);
    end;
 // close(input);close(output);
end.

const
  fi='a.inp';
  fo='a.out';
  maxn=369;
var
  a : array[1..369] of longint;
  s : string;
  num,i,dem : longint;
begin
 // assign(input,fi);reset(input);
 // assign(output,fo);rewrite(output);
  read(num);
  read(s);
  a[1] := 5;
  for i := 2 to 366 do
  begin
    a[i] := (a[i-1] + 1) mod 8;
    if a[i] = 0 then a[i] := 1;
  end;
  if s = ' of week' then
    begin
      for i := 1 to 366 do
        if a[i] = num then inc(dem);
      writeln(dem);
    end
    else
    begin
      if num <30 then writeln(12) else
      if num =30 then writeln(11) else writeln(7);
    end;
  //close(input);close(output);
end.

var i,j,m,x:longint;
    s:string;
begin
    //readln(s);
    read(x);
    readln(s);
    if s[length(s)]='h' then begin
        if x<=29 then writeln(12) else if x<=30 then writeln(11) else writeln(7);
    end else begin
        if (x=5) or (x=6) then writeln(53) else writeln(52);
    end;
end.

program cofo_newyearandbear;
var
a, b, c, d: longint;
e: string;
begin
read(a);
read(e);
if (e[5]='w') then
begin
if (a<5) or (a=7) then write('52') else write ('53')
end;
if (e[5]='m') then
begin
if a<30 then write('12');
if a=30 then write('11');
if a=31 then write('7')
end
end.

var s:string;
a,b:integer;
begin
read(s);
a:=length(s);
if copy(s,a-3,4)='week' then
begin
 if (copy(s,1,1)<>'5') and (copy(s,1,1)<>'6') then
 writeln('52')
 else writeln('53');
end
else
 if copy(s,1,2)='30' then writeln('11')
  else
   if copy(s,1,2)='31' then writeln('7')
    else writeln('12');
end.

var
        a :array[1..12] of longint =(31,29,31,30,31,30,31,31,30,31,30,31);
        b :array[1..7] of longint =(4,5,6,7,1,2,3);
        sl :longint;
        aa,x,dem,i:longint;
        s :string;

begin
        readln(s);
        aa:=pos(' ',s);
        val(copy(s,1,aa-1),x);
        if s[length(s)]='h' then
                begin
                    sl:=0;
                    for i:=1 to 12 do
                            if x<=a[i] then inc(sl);
                    writeln(sl);
                end
        else
                begin
                    sl:=1;
                    dem:=b[x];
                    while dem+7<=366 do
                             begin
                            inc(sl);
                            dem:=dem+7;
                        end;
                    writeln(sl);
                end;
end.

const   fi='';//611a.inp';
        fo='';//611b.out';

var n,res  :longint;
    a,c    :array[0..100]of longint;
    f      :text;
    t      :longint;

procedure nhap;
var s:ansistring; i:longint;
begin
      assign(f,fi); reset(f);
               read(f,n,s);
               if s[length(s)]='k' then t:=1 else t:=2;
      close(f);
end;

procedure xuly;
var i,j,k:longint;
begin
     a[1]:=31 ;
     a[2]:=29 ;
     a[3]:=31 ;
     a[4]:=30 ;
     a[5]:=31 ;
     a[6]:=30 ;
     a[7]:=31 ;
     a[8]:=31 ;
     a[9]:=30 ;
     a[10]:=31 ;
     a[11]:=30 ;
     a[12]:=31 ;
     res:=0;
     if t=1 then
          begin
              k:=0;
              for i:=1 to 12 do inc(k,a[i]);
              dec(k,3); fillchar(c,sizeof(c),0);
              c[5]:=1; c[6]:=1; c[7]:=1;
              for i:=1 to k do
                 begin
                      if i mod 7=0 then j:=7 else j:=i mod 7;
                      inc(c[j]);
                 end;
              res:=c[n];
          end
      else
          begin
              for i:=1 to 12 do
                 if n<=a[i] then inc(res);
          end;
end;

procedure inkq;
begin
     assign(f,fo); rewrite(f);
              write(f,res);
     close(f);
end;
BEGIN
     nhap;
     xuly;
     inkq;
END.

Program qq;
Var I:LongInt;
    s:string;
    code:Integer;
begin
  Readln(s);
  i:=Pos('week',s);
  If I>0
   then begin
          s:=s[1];
          Val(s,i,code);
          Case i of
           5,6:Writeln(53)
           else Writeln(52);
          end;
        end
   else begin
          i:=Pos(' ',s);
          s:=Copy(s,1,i-1);
          Val(s,i,code);
          Case I of
           30:Writeln(11);
           31:Writeln(7)
           else Writeln(12);
          end;
        end;
End.

const
  ngay: array[1..31] of longint
        = (12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
           12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
           12, 12, 12, 12, 12, 12, 12, 12, 12, 11,
           7);

var
  s: string;
  k, num, code: longint;

 begin
   assign(input, ''); reset(input);
   assign(output, ''); rewrite(output);
   readln(s);
   k:= pos('week', s);
   if k = 0 then
        begin
          if s[2] <> ' ' then
                val(s[1] + s[2], num, code)
          else
                val(s[1], num, code);
          writeln(ngay[num]);
        end
   else
        if (s[1] = '5') or (s[1] = '6') then
                writeln(53)
        else
                writeln(52);
   close(input); close(output);
 end.

var s,s1:string; a:longint;
begin
read(a,s,s1);
if s=' of week' then
if(a=5) or (a=6) then write(53)
		else write(52)
 else
if s=' of month' then
 if(a <= 29) then write(12)
	else
	if(a <= 30) then write(11)
	else write(7);
	end.

const
 mo:array[1..12]of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
var
 q,ans,i,j,n,m,k,t,x:longint;
 s:ansistring;
begin
 read(x);
 readln(s);
 k:=5;t:=1;q:=1;
 for i:=1 to 366 do
 begin
  if(k=x)and(s[length(s)]='k')then inc(ans);
  if(q=x)and(s[length(s)]='h')then inc(ans);
  inc(q);
  if q>mo[t] then begin inc(t);q:=1;end;
  inc(k);
  if k=8 then k:=1;
 end;
 writeln(ans);
end.

program goodbye2015a;

const t=5;

var
  inp:string;
  k,p:integer;

procedure Week;
var j,cnt,d,i:integer; A:array[1..366] of byte;
begin
     cnt:=0;
     d:=0;
     j:=t;
     while cnt<=366 do begin
       d:=d+1;
       cnt:=cnt+1;
       if j<=7 then A[d]:=j else begin j:=1; A[d]:=j end;
       j:=j+1;
     end;
     for i:=1 to 366 do if A[i]=k then p:=p+1;
end;

procedure Month;
begin
     if k in [1..29] then p:=12;
     if k=30 then p:=11;
     if k=31 then p:=7;
end;

procedure Detach;
var i,j,code:integer; A:array[1..2] of integer;
begin
     j:=0;
     for i:=1 to length(inp) do
         if inp[i] in ['0'..'9'] then begin
           j:=j+1;
           val(inp[i],A[j],code);
           if j=2 then break;
         end;
     if j=1 then k:=A[1];
     if j=2 then k:=A[1]*10+A[2];
     if inp[length(inp)]='k' then Week;
     if inp[length(inp)]='h' then Month;
end;

begin
  readln(inp);
  Detach;
  writeln(p);
end.

var n, i: longint;
    s: string;
begin
  read(n);   read(s);
  if s[length(s)] = 'k' then
   begin
    if (n >= 5) and (n <= 6) then write(53)
    else write(52);
   end
  else
   begin
    if n = 31 then write(7)
    else if n = 30 then write(11)
    else write(12);
   end;
end.

label 1;
const ay:array[1..12]of integer=(31,29,31,30,31,30,31,31,30,31,30,31);
var x,k,g,f,h,a,t,y:integer;
q:string;
begin read(x,q);a:=1;y:=1;
k:=pos('week',q);
if k<>0 then t:=1 else t:=0;
1:inc(g);inc(h);
if h=8 then h:=1;
if g>ay[a] then begin g:=1;inc(a);end;
if a>12 then begin a:=1;inc(y);end;
if y>2016 then begin write(f); halt;end;
if (y=2016)and(t=1)and(h=x) then begin inc(f);goto 1;end;
if (y=2016)and(t=0)and(g=x) then begin inc(f);goto 1;end else goto 1;end.

{$mode objfpc}
var
 s:ansistring;
 res,date:int64;

procedure input;
begin
 read(s);
end;

procedure solvemonth;
begin
 if s[2]=' ' then res:=12
  else
   begin
    date:=(ord(s[1])-48)*10+ord(s[2])-48;
    if (10<=date) and (date<=29) then res:=12;
    if date=30 then res:=11;
    if date=31 then res:=7;
   end;
end;

procedure solveweek;
begin
 case s[1] of
  '1':res:=52;
  '2':res:=52;
  '3':res:=53;
  '4':res:=52;
  '5':res:=53;
  '6':res:=53;
  '7':res:=52;
 end;
end;

procedure output;
begin
 write(res);
end;
begin
 input;
 if s[length(s)]='h' then solvemonth else solveweek;
 output;
end.

uses math;
var s,p:string; n:integer;
procedure Find;
var i,c:integer; t:string;
begin
   i:=1; t:='';
   while s[i]<>' ' do begin t:=t+s[i]; inc(i); end;
   val(t,n,c); delete(s,1,i+3);
   p:=s;
end;
BEGIN
   readln(s);
   Find;
   if p='month' then
      begin
         if n=31 then write('7') else
         if (n=30) or (n=29) then write('11') else
         write('12');
      end
   else
   begin
      if (n=1) then write('53')
      else write('52');
   end;
END.

var s:string;
a,b:integer;
begin
read(s);
a:=length(s);
if copy(s,a-3,4)='week' then
begin
 if (copy(s,1,2)<>'5') and (copy(s,1,2)<>'6') then
 writeln('52')
 else writeln('53');
end
else
 if copy(s,1,2)='30' then writeln('11')
  else
   if copy(s,1,2)='31' then writeln('7')
    else writeln('12');
end.

Var a,b,ans,i:longint;
    s:string;
 begin
   Readln(a,s);
   i:=1;

       if s=' of week' then begin if a=1 then write(52) else write(52) end
       else begin
              if a in [1..29] then begin
                                     write(12);
                                     halt;
                                    end
                                  else if a =30 then begin
                                                 write('11');
                                                 halt;
                                                 end
                                  else begin
                                      write('7');
                                      halt;
                                      end;

     end;

 end.

const
  fi='a.inp';
  fo='a.out';
  maxn=369;
var
  a : array[1..369] of longint;
  s : string;
  num,i,dem : longint;
begin
//  assign(input,fi);reset(input);
//  assign(output,fo);rewrite(output);
  read(num);
  read(s);
  a[1] := 5;
  for i := 2 to 365 do
  begin
    a[i] := (a[i-1] + 1) mod 8;
    if a[i] = 0 then a[i] := 1;
  end;
  if s = ' of week' then
    begin
      for i := 1 to 365 do
        if a[i] = num then inc(dem);
      writeln(dem);
    end
    else
    begin
      if num <30 then writeln(12)
      else
      if num =30 then writeln(11) else writeln(7);
    end;
 // close(input);close(output);
end.

{$mode objfpc}
var
  s : ansistring;
  n : integer;
begin
   read(n);
   readln(s);
   if s[5] = 'w' then
      begin
         if n = 5   then writeln('53')
         else writeln(52);
      end
    else
       begin
          if n <= 27 then writeln('12')
          else
           if n = 28 then writeln(0)
           else
             if n = 29 then writeln(1)
             else
                if n = 30 then writeln(11)
                else writeln(7);
       end;
end.

var n,i,j,k:longint;
    a,b,c,d:char;
    s:string;
begin
  readln(n,a,b,c,d,s);
  if s='week' then
    writeln('52')
  else
    begin
      if n<=29 then
        writeln('12')
      else if n=30 then
        writeln('11')
      else if n=31 then
        writeln('7');
    end;
end.

var s:string;
    x:integer;
procedure nhap(var s:string;var x:integer);
var i,code:integer;
    s1:string;
begin
   read(s);
   s1:='';
   for i:=1 to length(s) do
      if(s[i] in ['0'..'9']) then
         s1:=s1+s[i];
   val(s1,x,code);
end;
procedure xuli(s:string;x:integer);
begin
   if((x>=1) and (x<=7)) then
      if((pos('week',s)<>0) and (x>=1) and (x<=4) or (x=7)) then write(52)
      else write(53);
   if(x>=1) and (x<=31) then
      if((x>=1) and (x<=29)) then write(12)
         else if(x=31) then write(7)
            else if(x=30) then write(11);
end;
BEGIN
   nhap(s,x);
   xuli(s,x);
END.

var
s:string;
Begin
read(s);
if (pos('6 of week',s)>0) or (pos('5 of week',s)>0) then write('53')
else if ((pos('week',s)>0) and ((pos('6',s)<0) and (pos('5',s)<0))) then write('52')
else if (pos('31',s)>0) then write('7')
else if (pos('30',s)>0) then write('11')
else write('12');
end.

  {$MODE OBJFPC}
  {$COPERATORS ON}
const
  {$IFDEF ONLINE_JUDGE}
        InputFile  = '';
        OutputFile = '';
  {$ELSE}
        InputFile  = 'Inp.inp';
        OutputFile = 'Out.out';
  {$ENDIF}
const
        month   :       array[1..12] of integer = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        // Start a year with friday !
var
        n : integer;
        s : string;
        ans : char;
procedure enter;
var i, j : longint;
        begin
                read(n);
                readln(s);
                for i:=1 to length(s) do if s[i]='w' then
                 begin
                        ans:='w';
                        break;
                 end else if s[i]='m' then
                  begin
                        ans:='m';
                        break;
                  end;
        end;
procedure next(var day:integer);
        begin
                day+=1; if day>7 then day:=1;
        end;
procedure solve;
var i, day, m, j, res: longint;
        begin
                day:=1;  res:=0;

                case ans of
                        'w' :
                         begin
                                for i:=1 to 12 do
                                 begin
                                        for j:=1 to month[i] do
                                         begin
                                                if day=n then inc(res);
                                                next(day);
                                         end;
                                 end;
                         end;
                         'm':
                         begin
                                for i:=1 to 12 do
                                 if month[i]>=n then inc(res);
                         end;
                end;
                writeln(res);
        end;
begin
                assign(input, InputFile); reset(input);
                assign(output, OutputFile); rewrite(output);
        try
                enter;
                Solve;
        finally
                close(input);
                close(output);
        end;
end.

program lepeshki;

var
a: array [0..100] of longint;
n,k,max,d,m,o,otv,x: int64;
i,j,code,metka: longint;
s,p: string;
Begin
{assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);    }
read(s);
k:=pos(' ',s);
for I:=1 to k-1 do
        p:=p+s[i];
val(p,x,code);
if pos('m',s)=0 then begin k:=pos('w',s); metka:=1; end
                else begin k:=pos('m',s); metka:=2; end;

if metka=1 then begin
                if x=1 then write('51');
                if x=2 then write('51');
                if x=3 then write('51');
                if x=4 then write('52');
                if x=5 then write('52');
                if x=6 then write('53');
                if x=7 then write('51');
                end
           else begin
                if x<=29 then write('12');
                if x=31 then write('7');
                if x=30 then write('11');
                end;
{close(input);
close(output); }
end.

{Aleksey_b}
var s,s1:string;
    a,b:longint;
    code:integer;

begin
 readln(s);
 if s[2]<>' ' then begin s1:=s1+s[1]+s[2];delete(s,1,3) end
              else begin s1:=s1+s[1];delete(s,1,2) end;
 val(s1,a,code);
 if s='of week' then begin
                      write('52');
                     end
                else begin
                      if a>=30 then write('11')
                               else write('12');
                     end;
end.

 var s:string;
 a,b,c,n,m,i,d,q,j,max:longint;
 begin
readln(s);
val(s,a,c);
if s[length(s)]='k' then writeln(52) else
case a of
1..29:writeln(12);
30:writeln(11);
31:writeln(7);
end;
end.

var k,n:byte;
       s:string;
begin
read(k,s);
if pos('w',s)<>0 then begin
if k<5 then write(52) else
if k<7 then write(53) else write(52);
end else
begin
if k<30 then write(12) else
if k=30 then write(5) else
write(7);
end;
end.

program goodbye2015a;

const t=4;

var
  inp:string;
  k,p:integer;

procedure Week;
var j,cnt,d,i:integer; A:array[1..366] of byte;
begin
     cnt:=0;
     d:=0;
     j:=t;
     while cnt<=366 do begin
       d:=d+1;
       cnt:=cnt+1;
       if j<=7 then A[d]:=j else begin j:=1; A[d]:=j end;
       j:=j+1;
     end;
     for i:=1 to 366 do if A[i]=k then p:=p+1;
end;

procedure Month;
begin
     if k in [1..29] then p:=12;
     if k=30 then p:=11;
     if k=31 then p:=7;
end;

procedure Detach;
var i,j,code:integer; A:array[1..2] of integer;
begin
     j:=0;
     for i:=1 to length(inp) do
         if inp[i] in ['0'..'9'] then begin
           j:=j+1;
           val(inp[i],A[j],code);
           if j=2 then break;
         end;
     if j=1 then k:=A[1];
     if j=2 then k:=A[1]*10+A[2];
     if inp[length(inp)]='k' then Week;
     if inp[length(inp)]='h' then Month;
end;

begin
  readln(inp);
  Detach;
  writeln(p);
end.

var s:string;
    x,i,ans:longint;
begin
read(s);
val(copy(s,1,pos(' ',s)-1),x,ans);
delete(s,1,pos(' ',s));
if s='of week'
   then  if (x=5) or (x=6) then ans:=54 else ans:=52
   else  if x<30 then ans:=12
                 else if x=30 then ans:=11
                              else ans:=7;
write(ans);
end.

{$mode objfpc}
const inpf='';
      outf='';
      maxN=round(1e3)+2;

var fi,fo:text;
    s,s1:ansistring;
    i,k,l:integer;

procedure openfiles;
  begin
    assign(fi,inpf);reset(fi);
    assign(fo,outf);rewrite(fo);
  end;

procedure closefiles;
  begin
    close(fi);close(fo);
  end;

procedure solve1;
  begin
    if k<=28 then writeln(12)
    else if k<=30 then writeln(11)
        else writeln(7);
  end;

procedure solve2;
  var res,i,p:integer;
  begin
    p:=4;
    res:=0;
    for i:=1 to 365 do
      begin
         inc(p);
         if p=8 then p:=1;
         if p=k then inc(res);
      end;
    writeln(res);
  end;

begin
  openfiles;
  readln(fi,s);
  s1:='';
  for i:=1 to length(s) do
    if s[i]<>' ' then s1:=s1+s[i]
    else break;
  val(s1,k,l);
  s1:=s[length(s)];
  if s1='h' then solve1
  else solve2;
  closefiles;
end.

const
  fi='a.inp';
  fo='a.out';
  maxn=369;
var
  a : array[1..369] of longint;
  s : string;
  num,i,dem : longint;
begin
//  assign(input,fi);reset(input);
//  assign(output,fo);rewrite(output);
  read(num);
  read(s);
  a[1] := 5;
  for i := 2 to 365 do
  begin
    a[i] := (a[i-1] + 1) mod 8;
    if a[i] = 0 then a[i] := 1;
  end;
  if s = ' of week' then
    begin
      {for i := 1 to 365 do
        if a[i] = num then inc(dem);
      writeln(dem);}
      writeln(52);
    end
    else
    begin
      if num <30 then writeln(12)
      else
      if num =30 then writeln(11) else writeln(7);
    end;
  //close(input);close(output);
end.

{Aleksey_b}
var s,s1:string;
    a,b:longint;
    code:integer;

begin
 readln(s);
 if s[2]<>' ' then begin s1:=s1+s[1]+s[2];delete(s,1,3) end
              else begin s1:=s1+s[1];delete(s,1,2) end;
 val(s1,a,code);
 if s='of week' then begin
                      write('52');
                     end
                else begin
                      if a>=30 then begin
                                     if a=30 then write('12')
                                             else write('7');
                                    end
                               else write('12');
                     end;
end.

uses    math;
const   finp='';
        fout='';
var     fi,fo:text;
        s:string;
        n,i:longint;

BEGIN
        assign(fi,finp);reset(fi);
        assign(fo,fout);rewrite(fo);
        readln(fi,s);
        i:=1; n:=0;
        while s[i] in ['0'..'9'] do
         begin
                n:=n*10+ord(s[i])-48;
                inc(i);
         end;
        i:=i-1;
        if length(s)-i=8 then
         begin
                if (n=5) or (n=6) then writeln(fo,53) else writeln(fo,52);
         end else
         begin
                if n=29 then writeln(fo,1) else
                if n=30 then writeln(fo,11) else
                if n=31 then writeln(fo,7) else
                writeln(fo,12);
         end;
        close(fi);close(fo);
END.

program z1;
var
ch,a:string;
code,chis:longint;

begin
{assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);}
read(a);
while a[1]<>' ' do
 begin
  ch:=ch+a[1];
  delete(a,1,1);
 end;
val(ch,chis,code);
if pos('w',a)<>0 then case chis of
                    1:write('51');
                    2:write('51');
                    3:write('51');
                    4:write('52');
                    5:write('52');
                    6:write('53');
                    7:write('51');
                    end
               else if chis<=29 then write('12')
                                else if chis=30 then write('11')
                                                else write('7');
{close(input);
close(output);}
end.

var i,n,lik,kod,kol,t:longint;
s,l:string;
a,b:array [0..1000] of longint;
begin
b[1]:=31;
b[2]:=29;
b[3]:=31;
b[4]:=30;
b[5]:=31;
b[6]:=30;
b[7]:=31;
b[8]:=31;
b[9]:=30;
b[10]:=31;
b[11]:=30;
b[12]:=31;

readln(s);
if (s[2]=' ') then begin l:=s[1];delete(s,1,2);end else
begin l:=s[1]+s[2];delete(s,1,3);end;
val(l,lik,kod);
t:=0;
for i:=1 to 366 do
begin
inc(t);
a[i]:=t;
if (t>=7) then t:=0;
end;
if (s='of week') then
begin
for i:=1 to 366 do
if (a[i]=lik) then inc(kol);
end else
if (s='of month') then
begin
for i:=1 to 12 do
begin
if(b[i]>=lik) then inc(kol);

end;

end;
writeln(kol);
end.

const
 mo:array[1..12]of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
var
 q,ans,i,j,n,m,k,t,x:longint;
 s:ansistring;
begin
 read(x);
 readln(s);
 k:=5;t:=1;q:=1;
 for i:=1 to 365 do
 begin
  if(k=x)and(s[length(s)]='k')then inc(ans);
  if(q=x)and(s[length(s)]='h')then inc(ans);
  inc(q);
  if q>mo[t] then begin inc(t);q:=1;end;
  inc(k);
  if k=8 then k:=1;
 end;
 writeln(ans);
end.

var
  s : string;
  a,ans,_,i : longint;
  d : array[1..12] of longint = (31,29,31,30,31,30,31,31,30,31,30,31);

begin
  readln(s); val(copy(s,1,pos(' ',s)-1),a,_);
  writeln(a);
  if s[length(s)] = 'k' then begin
    writeln(366 div 7 + ord(366 mod 7 >= a));
  end else begin
    for i:=1 to 12 do if a <= d[i] then inc(ans);
    writeln(ans);
  end;
end.

program goodbye2015a;

const t=4;

var
  inp:string;
  k,p:integer;

procedure Week;
var j,cnt,d,i:integer; A:array[1..366] of byte;
begin
     cnt:=0;
     d:=0;
     j:=t;
     while cnt<=366 do begin
       d:=d+1;
       cnt:=cnt+1;
       if j<=7 then A[d]:=j else j:=0;
       j:=j+1;
     end;
     for i:=1 to 366 do if A[i]=k then p:=p+1;
end;

procedure Month;
begin
     if k in [1..29] then p:=12;
     if k=30 then p:=11;
     if k=31 then p:=7;
end;

procedure Detach;
var i,j,code:integer; A:array[1..2] of integer;
begin
     j:=0;
     for i:=1 to length(inp) do
         if inp[i] in ['0'..'9'] then begin
           j:=j+1;
           val(inp[i],A[j],code);
           if j=2 then break;
         end;
     if j=1 then k:=A[1];
     if j=2 then k:=A[1]*10+A[2];
     if inp[length(inp)]='k' then Week;
     if inp[length(inp)]='h' then Month;
end;

begin
  readln(inp);
  Detach;
  writeln(p);
end.

{$MODE OBJFPC}
var    a:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=5) or (a=6) or (a=7)
          or (a=2) then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) or (a=31) then writeln(11) else writeln(12)
end.

const me:array[1..12] of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
const dn:array[1..7] of longint=(52,52,52,52,52,52,52);
var a:array[0..100] of longint;
    kol,lik,pr,i,j,n,m:longint;
    s,s1,ss:string;
begin
readln(s);
       i:=1;
while(pr<>1)do
begin
val(s[i],lik,pr);
if pr=0 then begin j:=j*10+lik;delete(s,i,1);end else
inc(i);
end;
if s=' of month'then begin
for i:=1 to 12 do
if me[i]>=j then inc(kol);
writeln(kol); halt;end;

if s=' of week'then begin
writeln(dn[j]); halt;end;
end.

var
s:string;
Begin
read(s);
if pos('week',s)>0 then write('52');
if pos('month',s)>0 then Begin
if ((pos('29',s)>0) or (pos('30',s)>0) or (pos('31',s)>0))  then write('11')
else write('12');
end;
end.

{$MODE OBJFPC}
var    a:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=5) then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) or (a=31) then writeln(11) else writeln(12)
end.

var
  s:string;
  i,code,data,data2,q:integer;
begin
  read(s);
  q:=length(s);
  if s[q]='h'
        then begin
               val(s[1],data,code);
               data:=data*10;
               val(s[2],data2,code);
               data:=data+data2;
             end
        else val(s[1],data,code);

  if (data<>30) and (data<>31) and (data<>0) and (s[q]='h')
    then begin
           writeln ('12');
           exit;
         end
    else
      if (data=30) and(s[q]='h')
        then begin
               writeln ('11');
               exit;
        end
        else
         if (
         data=31) and (s[q]='h')
         then begin
                writeln ('7');
                exit;
              end;
  {val(s[1], data,code)
  if data=1
    then
      begin
      writeln('52');
      exit;
      end;
    else if data=2
    then
      begin
      writeln('');
      exit;
      end;
    else if data=3
    then
      begin
      writeln('');
      exit;
      end;
    else if data=4
    then
      begin
      writeln('52');
      exit;
      end;
    else if data=5
    then
      begin
      writeln('');
      exit;
      end;
    else if data=6
    then
      begin
      writeln('');
      exit;
      end;
    else if data=7
    then
      begin
      writeln('');
      exit;
      end;
    else}

writeln('52')

end.

{
Author: TinTin
Problem: A. New Year and Days
Link: http://codeforces.com/contest/611/problem/A
Algo:
Comp:
}
var st:string;
    a:array[2..8] of integer;
//--------------------------
procedure input;
begin
  readln(st);
end;
//--------------------------
procedure init;
begin
  fillchar(a,sizeof(a),0);
end;
//--------------------------
procedure process;
var i,d,n,code:integer;
    st1:string;
begin
  d:=5;
  st1:='';
  for i:=pos(#32,st)-1 downto 1 do
    st1:=st[i]+st1;
  if pos('w',st)>0 then
    begin
      n:=0;
      val(st1,i,code);
      while n<=366 do
        begin
          inc(n);
          inc(d);
          inc(a[d]);
          if d=8 then d:=1;
        end;
      writeln(a[i+1]);
    end
  else
    begin
      if st1='31' then writeln(7);
      if st1='30' then writeln(11);
      if st1='29' then writeln(1)
      else writeln(12);
    end;
end;
//--------------------------
begin
  input;
  init;
  process;
end.

var
s:string;
Begin
read(s);
if pos('week',s)>0 then write('52');
if ((pos('29',s)>0) or (pos('30',s)>0) or (pos('31',s)>0))  then write('11')
else write('12');
end.

 var s:string;
 a,b,c,n,m,i,d,q,j,max:longint;
 begin
readln(s);
if (ord(s[2])>47) and (ord(s[2])<58) then val(copy(s,1,2),a,b) else val(s[1],a,b);
if s[length(s)]='k' then
case a of
1:writeln(52);
2:writeln(52);
3:writeln(52);
4:writeln(52);
5:writeln(52);
6:writeln(53);
7:writeln(52);
end
else
case a of
1..29:writeln(12);
30:writeln(11);
31:writeln(7);
end;
end.

var s:string;
a,b:integer;
begin
read(s);
a:=length(s);
if copy(s,a-3,4)='week' then
begin
 if (copy(s,1,2)<>'5') and (copy(s,1,2)<>'6') then
 writeln('52')
 else writeln('53');
end
else
 if copy(s,1,2)='30' then writeln('11')
  else
   if copy(s,1,2)='31' then writeln('7')
    else writeln('12');
end.

var n, kol : Integer;
          s : String;
begin
  read(n);
  readln(s);
  If s =  ' of week' then begin
                           kol := 52;
                           If n > 4 then inc(kol);
                         end
                    else begin
                           kol := 12;
                           If n = 31 then kol := 8;
                           If n = 30 then kol := 11;
                         end;
  writeln(kol);
end.

    var
		m, n: int64;
		s, s1: string;

    begin

		readln(s);
		for var i := 1 to s.length do
		begin
			if (s[i] = ' ') then
				break;
			s1 += s[i];
		end;

		if (pos('w', s) > 0) then
		begin
			if (StrToInt(s1) = 6) or (StrToInt(s1) = 7) then
				writeln(53)
			else
				writeln(52);
		end
		else begin
			if (StrToInt(s1) <= 29) then
				writeln(12);
			if (StrToInt(s1) = 31) then
				writeln(7);
			if (StrToInt(s1) > 29) and (StrToInt(s1) <= 30) then
				writeln(11);
		end;

    end.

{$MODE OBJFPC}
var    a:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=1) or (a=2) then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) or (a=31) then writeln(11) else writeln(12)
end.

var k,n:integer;
  s:string;
begin
read(k,s);
if pos('w',s)<>0 then
begin
if k<5 then write(52) else
if k<7 then write(53) else write(52);
end else
if k=30 then write(11) else
if k<30 then write(12);
end.

{$MODE OBJFPC}
var    a:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=5) or (a=6)  then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) or (a=31) then writeln(11) else writeln(12)
end.

uses math;
var s,p:string; n:integer;
procedure Find;
var i,c:integer; t:string;
begin
   i:=1; t:='';
   while s[i]<>' ' do begin t:=t+s[i]; inc(i); end;
   val(t,n,c); delete(s,1,i+3);
   p:=s;
end;
BEGIN
   readln(s);
   Find;
   if p='month' then
      begin
         if n=31 then write('7') else
         if n=30 then write('4') else
         write('12')
      end
   else
   begin
      if (n=5) or (n=6) then write('53')
      else write('52');
   end;
END.

program yan;
  var s,s1,s2:string; i,j,x,y,b:integer;
begin
  read(s);
  b:=31+29+31+30+31+30+31+31+30+31+30+31;
  for i:=1 to length(s) do
    if s[i] in ['0'..'9'] then s1:=s1+s[i];
  val(s1,x,y);
  if s[length(s)]='h' then
    begin
      if x<30 then j:=12;
      if x=30 then j:=11;
      if x>30 then j:=7;
    end
  else
    begin
      j:=b div 7;
      if j mod 7>=x then inc(j);
    end;
  writeln(j);
end.

  {$MODE OBJFPC}
  {$COPERATORS ON}
const
  {$IFDEF ONLINE_JUDGE}
        InputFile  = '';
        OutputFile = '';
  {$ELSE}
        InputFile  = 'Inp.inp';
        OutputFile = 'Out.out';
  {$ENDIF}
const
        month   :       array[1..12] of integer = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        // Start a year with friday !
var
        n : integer;
        s : string;
        ans : char;
procedure enter;
var i, j : longint;
        begin
                read(n);
                readln(s);
                for i:=1 to length(s) do if s[i]='w' then
                 begin
                        ans:='w';
                        break;
                 end else if s[i]='m' then
                  begin
                        ans:='m';
                        break;
                  end;
        end;
procedure next(var day:integer);
        begin
                day+=1; if day>7 then day:=1;
        end;
procedure solve;
var i, day, m, j, res: longint;
        begin
                day:=6;  res:=0;

                case ans of
                        'w' :
                         begin
                                for i:=1 to 12 do
                                 begin
                                        for j:=1 to month[i] do
                                         begin
                                                if day=n then inc(res);
                                                next(day);
                                         end;
                                 end;
                         end;
                         'm':
                         begin
                                for i:=1 to 12 do
                                 if month[i]>=n then inc(res);
                         end;
                end;
                writeln(res);
        end;
begin
                assign(input, InputFile); reset(input);
                assign(output, OutputFile); rewrite(output);
        try
                enter;
                Solve;
        finally
                close(input);
                close(output);
        end;
end.

const   fin='';
        fon='';
        maxC=1000000007;
var     c:array [1..10000,1..10000] of longint;
        n,m,k,x:longint;
        s:string;
        fi,fo:text;
        procedure openf;
        begin
                assign(fi,fin); reset(fi);
                assign(fo,fon); rewrite(fo);
        end;
        procedure closef;
        begin
                close(fi);
                close(fo);
        end;
        Procedure nhap;
        begin
                read(fi,x);
                read(fi,s);
        end;
        procedure xuly;
        begin
        if length(s)=9 then
                begin
                if x<29 then writeln(fo,12);
                if x=29 then writeln(fo,12);
                if x=30 then writeln(fo,11);
                if x=31 then writeln(fo,8);
                end;
        if length(s)=8 then
                begin
                if x=6 then begin writeln(fo,53); exit; end;
                if x=5 then begin writeln(fo,53); exit; end;
                writeln(fo,52);
                end;
        end;
        procedure xuat;
        begin
        end;

        BEGIN
                openf;
                NHAP;
                XULY;
                XUAT;
                closef;
        END.

program lepeshki;

var
a: array [0..100] of longint;
n,k,max,d,m,o,otv,x: int64;
i,j,code,metka: longint;
s,p: string;
Begin
{assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);    }
read(s);
k:=pos(' ',s);
for I:=1 to k-1 do
        p:=p+s[i];
val(p,x,code);
if pos('m',s)=0 then begin k:=pos('w',s); metka:=1; end
                else begin k:=pos('m',s); metka:=2; end;

if metka=1 then begin
                if x=1 then write('51');
                if x=2 then write('51');
                if x=3 then write('51');
                if x=4 then write('52');
                if x=5 then write('52');
                if x=6 then write('52');
                if x=7 then write('51');
                end
           else begin
                if x<=29 then write('12');
                if x=31 then write('7');
                if x=30 then write('11');
                end;
{close(input);
close(output); }
end.

program lepeshki;

var
a: array [0..100] of longint;
n,k,max,d,m,o,otv,x: int64;
i,j,code,metka: longint;
s,p: string;
Begin
{assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);    }
read(s);
k:=pos(' ',s);
for I:=1 to k-1 do
        p:=p+s[i];
val(p,x,code);
if pos('m',s)=0 then begin k:=pos('w',s); metka:=1; end
                else begin k:=pos('m',s); metka:=2; end;

if metka=1 then begin
                if x=1 then write('52');
                if x=2 then write('52');
                if x=3 then write('52');
                if x=4 then write('52');
                if x=5 then write('52');
                if x=6 then write('53');
                if x=7 then write('51');
                end
           else begin
                if x<=29 then write('12');
                if x=31 then write('7');
                if x=30 then write('11');
                end;
{close(input);
close(output); }
end.

program A_611;

var
  n:longint;
  s:string;

begin
  read(n);
  read(s);
  if s[5]='w'
    then write('52')
    else case n of
      31:write('7');
      30:write('11');
      1..29:write('12');
    end;
end.

var
  a: longint;
  x: string;

begin
  read(a, x);
  if x = ' of week'
  then begin
    if (a = 6) or (a = 5) then write('53')
    else if a = 7 then write('51')
    else write('52')
  end
  else
  begin
    if a <= 29 then write('12')
    else if a = 31 then write('7')
    else write('11');

  end;
end.

var sl,s:string; t:integer;
begin
 readln(sl);
 if (sl[1] in ['1' .. '9']) and (sl[2] in ['0' ..'9']) then
  begin
   s:=sl[1] + sl[2];
   val(s,t);
  end
   else val(sl[1],t);
 if pos('week',sl) <> 0 then
  begin
   inc(t);
   if t = 2 then write('53')
    else write('52');
  end
   else
    begin
     if (t = 30) or (t = 29) then begin write('11'); exit; end;
     if t = 31 then begin write('7'); exit; end;
     write('12');
    end;
end.

program z1;
var
ch,a:string;
code,chis:longint;

begin
{assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);}
read(a);
while a[1]<>' ' do
 begin
  ch:=ch+a[1];
  delete(a,1,1);
 end;
val(ch,chis,code);
if pos('w',a)<>0 then case chis of
                    1:write('52');
                    2:write('51');
                    3:write('51');
                    4:write('52');
                    5:write('52');
                    6:write('53');
                    7:write('51');
                    end
               else if chis<=29 then write('12')
                                else if chis=30 then write('11')
                                                else write('7');
{close(input);
close(output);}
end.

var s:string;
a,b:integer;
begin
read(s);
a:=length(s);
if copy(s,a-3,4)='week' then
begin
 if (copy(s,1,2)<>'5') and (copy(s,1,2)<>'6') then
 writeln('52')
 else writeln('53');
end
else
 if copy(s,1,2)='30' then writeln('11')
  else
   if copy(s,1,2)='31' then writeln('7')
    else writeln('12');
end.

var n, kol : Integer;
          s : String;
begin
  read(n);
  readln(s);
  If s =  ' of week' then begin
                           kol := 52;
                           If n > 4 then inc(kol);
                         end
                    else begin
                           kol := 12;
                           If n = 31 then kol := 7;
                           If n = 30 then kol := 11;
                         end;
  writeln(kol);
end.

{$mdoe objfpc}
var
  s: ansistring;
  i, c: integer;
begin
  readln(s);
  if pos('week',s) <> 0 then begin
    case ord(s[1]) - 48 of
      1,2,3,4,5,7: writeln(52);
      6: writeln(53);
    end;
  end;
  c := 0;
  if pos('month',s) <> 0 then begin
    for i := 1 to 2 do c := c * 10 + ord(s[i]) - 48;
    if c <= 28 then writeln('12');
    if (c = 29) or (c = 30) then writeln('11');
    if c = 31 then writeln('7');
  end;
end.

uses math;
var s,p:string; n:integer;
procedure Find;
var i,c:integer; t:string;
begin
   i:=1; t:='';
   while s[i]<>' ' do begin t:=t+s[i]; inc(i); end;
   val(t,n,c); delete(s,1,i+3);
   p:=s;
end;
BEGIN
   readln(s);
   Find;
   if p='month' then
      begin
         if n=31 then write('7') else
         if (n=30) or (n=29) then write('11') else
         write('12');
      end
   else
   begin
      if (n=1) then write('53')
      else write('52');
   end;
END.

const
  fi='a.inp';
  fo='a.out';
  maxn=369;
var
  a : array[1..369] of longint;
  s : string;
  num,i,dem : longint;
begin
  //assign(input,fi);reset(input);
 // assign(output,fo);rewrite(output);
  read(num);
  read(s);
  a[1] := 5;
  for i := 2 to 365 do
  begin
    a[i] := (a[i-1] + 1) mod 8;
    if a[i] = 0 then a[i] := 1;
  end;
  if s = ' of week' then
    begin
      {for i := 1 to 365 do
        if a[i] = num then inc(dem);
      writeln(dem);}
      writeln(52);
    end
    else
    begin
      if num <29 then writeln(12) else
      if num = 29 then writeln(11)
      else
      if num =30 then writeln(11) else writeln(7);
    end;
 // close(input);close(output);
end.

var
s:string;
Begin
read(s);
if pos('week',s)>0 then write('52');
if ((pos('29',s)>0) or (pos('30',s)>0) or (pos('31',s)>0))  then write('11')
else write('12');
end.

const   fin='';
        fon='';
        maxC=1000000007;
var     c:array [1..10000,1..10000] of longint;
        n,m,k,x:longint;
        s:string;
        fi,fo:text;
        procedure openf;
        begin
                assign(fi,fin); reset(fi);
                assign(fo,fon); rewrite(fo);
        end;
        procedure closef;
        begin
                close(fi);
                close(fo);
        end;
        Procedure nhap;
        begin
                read(fi,x);
                read(fi,s);
        end;
        procedure xuly;
        begin
        if length(s)=9 then
                begin
                if x<29 then writeln(fo,12);
                if x=29 then writeln(fo,12);
                if x=30 then writeln(fo,11);
                if x=31 then writeln(fo,8);
                end;
        if length(s)=8 then
                begin
                writeln(fo,52);
                end;
        end;
        procedure xuat;
        begin
        end;

        BEGIN
                openf;
                NHAP;
                XULY;
                XUAT;
                closef;
        END.

program zzz;
  var
    x,kol:integer;
    s:string;
begin
  read(x,s);
  if pos('week',s)>0 then case x of
                            1..4,6,7:writeln('52');
                            5:writeln('53');
                          end
                     else case x of
                            1..29:writeln('12');
                            30:writeln('4');
                            31:writeln('7');
                          end;
end.

var
    a: Integer;
    s: string;

begin
    Read (a);
    ReadLn (s);

    if s[Length (s)] = 'k' then
        if a in  [1..4, 7] then
            WriteLn (52)
        else
            WriteLn (53)
    else
        if a in [1..30] then
            WriteLn (11)
        else if a = 28 then
            WriteLn (7)
end.

{$mdoe objfpc}
var
  s: ansistring;
  i, c: integer;
begin
  readln(s);
  if pos('week',s) <> 0 then begin
    case ord(s[1]) - 48 of
      1,2,3,4,5,7: writeln(52);
      6: writeln(51);
    end;
  end;
  c := 0;
  if pos('month',s) <> 0 then begin
    for i := 1 to 2 do c := c * 10 + ord(s[i]) - 48;
    if c <= 28 then writeln('12');
    if (c = 29) or (c = 30) then writeln('11');
    if c = 31 then writeln('7');
  end;
end.

var sl,s:string; t:integer;
begin
 readln(sl);
 if (sl[1] in ['1' .. '9']) and (sl[2] in ['0' ..'9']) then
  begin
   s:=sl[1] + sl[2];
   val(s,t);
  end
   else val(sl[1],t);
 if pos('week',sl) <> 0 then
  begin
   inc(t);
   if (t = 2) or (t = 3) then write('53')
    else write('52');
  end
   else
    begin
     if t = 30 then begin write('11'); exit; end;
     if t = 31 then begin write('7'); exit; end;
     write('12');
    end;
end.

{$MODE OBJFPC}
var    a:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=5) or (a=6)  then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) or (a=31) then writeln(11) else writeln(12)
end.

var n, kol : Integer;
          s : String;
begin
  read(n);
  readln(s);
  If s =  ' of week' then begin
                           kol := 52;
                           If n > 4 then inc(kol);
                         end
                    else begin
                           kol := 12;
                           If n = 31 then kol := 8;
                           If n = 30 then kol := 11;
                         end;
  writeln(kol);
end.

{$MODE OBJFPC}
var    a,i:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=6) then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) then writeln(11) else
          if a=31 then writeln(7) else writeln(12)
end.

program z1;
var
ch,a:string;
code,chis:longint;

begin
{assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);}
read(a);
while a[1]<>' ' do
 begin
  ch:=ch+a[1];
  delete(a,1,1);
 end;
val(ch,chis,code);
if pos('w',a)<>0 then case chis of
                    1:write('51');
                    2:write('51');
                    3:write('51');
                    4:write('52');
                    5:write('52');
                    6:write('52');
                    7:write('51');
                    end
               else if chis<=29 then write('12')
                                else if chis=30 then write('11')
                                                else write('7');
{close(input);
close(output);}
end.

var
  s : string;
  a,ans,_,i : longint;
  d : array[1..12] of longint = (31,29,31,30,31,30,31,31,30,31,30,31);

begin
  readln(s); val(copy(s,1,pos(' ',s)-1),a,_);
 // writeln(a);
  if s[length(s)] = 'k' then begin
    writeln(366 div 7 + ord(a in [5,6,7]));
  end else begin
    for i:=1 to 12 do if a <= d[i] then inc(ans);
    writeln(ans);
  end;
end.

const
 mo:array[1..12]of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
var
 q,ans,i,j,n,m,k,t,x:longint;
 s:ansistring;
begin
 read(x);
 readln(s);
 k:=5;t:=1;q:=1;
 for i:=1 to 365 do
 begin
  if(k=x)and(s[length(s)]='k')then inc(ans);
  if(q=x)and(s[length(s)]='h')then inc(ans);
  inc(q);
  if q>mo[t] then begin inc(t);q:=1;end;
  inc(k);
  if k=8 then k:=1;
 end;
 writeln(ans);
end.

var
	x,y:string;
	n:integer;

begin
	readln(n,x);
	if pos('of month', x)>0 then
	begin
		if n<=29 then writeln('12')
			else if n=30 then writeln('11')
				else if n=31 then writeln('7');
	end else if pos('of week', x)>0 then
	begin
		if ((n=6)or(n=7)) then writeln('53')
			else writeln('52');
	end;
end.

program goodbye2015a;

const t=4;

var
  inp:string;
  k,p:integer;

procedure Week;
var j,cnt:integer;
begin
     if k>7 then p:=0;
     if k<=0 then p:=0;
     if k<t then cnt:=7-(t-k);
     if k=t then cnt:=0;
     if k>t then cnt:=7-k;
     cnt:=366-cnt;
     p:=cnt div 7;
end;

procedure Month;
var j,cnt,m:integer;
begin
     if k>31 then p:=0;
     if k<=0 then p:=0;
     j:=1;
     cnt:=1;
     while cnt<=366 do begin
         j:=j+1;
         cnt:=cnt+1;
         if j=k then p:=p+1;
         if (j=30) and (m=2) then begin m:=m+1; j:=1; end;
         if (j=31) and (m in [4,6,9,11]) then begin m:=m+1; j:=1; end;
         if (j=32) and (m in [1,3,5,7,8,10,12]) then begin m:=m+1; j:=1; end;
     end;
end;

procedure Test;
var i:integer;
begin
     for i:=1 to length(inp) do begin
         if inp[i]='w' then begin Week; break; end;
         if inp[i]='m' then begin Month; break; end;
     end;
end;

procedure Detach;
var i,j,code:integer; A:array[1..2] of integer;
begin
     j:=0;
     for i:=1 to length(inp) do
         if inp[i] in ['1'..'9'] then begin
           j:=j+1;
           val(inp[i],A[j],code);
         end;
     if j=1 then begin k:=A[1]; Test; end;
     if j=2 then begin k:=A[1]*10+A[2]; Month; end;
end;

begin
  readln(inp);
  Detach;
  write(p);
  readln;
end.

{$MODE OBJFPC}
var    a:integer;s:ansistring;
begin
       readln(a,s);
       if s=' of week' then
          if (a=5) or (a=6) or (a=7)
          or (a=2) then writeln(53) else writeln(52);
       if s=' of month' then
          if (a=30) or (a=31) then writeln(11) else writeln(12)
end.

program A_611;

var
  n:longint;
  s:string;

begin
  read(n);
  read(s);
  if s[5]='w'
    then write('52')
    else case n of
      31:write('7');
      30:write('11');
      1..29:write('12');
    end;
end.

var
  s : string;
  a,ans,_,i : longint;
  d : array[1..12] of longint = (31,29,31,30,31,30,31,31,30,31,30,31);

begin
  readln(s); val(copy(s,1,pos(' ',s)-1),a,_);
  writeln(a);
  if s[length(s)] = 'k' then begin
    writeln(366 div 7 + ord(366 mod 7 >= a));
  end else begin
    for i:=1 to 12 do if a <= d[i] then inc(ans);
    writeln(ans);
  end;
end.

var
    a: Integer;
    s: string;

begin
    Read (a);
    ReadLn (s);

    if s[Length (s)] = 'k' then
        if a in  [1..4, 7] then
            WriteLn (52)
        else
            WriteLn (53)
    else
        if a in [1..29] then
            WriteLn (12)
        else if a = 30 then
            WriteLn (11)
        else if a = 28 then
            WriteLn (7)
end.

var     x,res:longint;
        s:string;
begin
        read(x);readln(s);
        while s[length(s)]=' ' do delete(s,length(s),1);
        if s[length(s)]='k' then
          begin
            res:=51;
            if (1<=x)and(x<=6)then inc(res);
            if (5<=x)and(x<=7) then inc(res);
            writeln(res);
          end
           else
          begin
            res:=12;
            if x=30 then res:=11;
            if x=31 then res:=6;
            writeln(res);
          end;
end.

var sl,s:string; t:integer;
begin
 readln(sl);
 if (sl[1] in ['1' .. '9']) and (sl[2] in ['0' ..'9']) then
  begin
   s:=sl[1] + sl[2];
   val(s,t);
  end
   else val(sl[1],t);
 if pos('week',sl) <> 0 then
  begin
   inc(t);
   if (t = 2) or (t = 3) then write('53')
    else write('52');
  end
   else
    begin
     if t = 30 then begin write('11'); exit; end;
     if t = 31 then begin write('7'); exit; end;
     write('12');
    end;
end.

Var n,i:longint;
    s:ansistring;
    a:array[1..31] of longint;
  begin
    read(n);
    readln(s);
    for i:=1 to 29 do
      a[i]:=12;
    a[30]:=11;
    a[31]:=7;
    if s=' of week' then writeln(52)
    else writeln(a[n]);
  end.


program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

  var a,b:integer;
      n,k:Integer;
      c,d:int64;

begin
readln(k,n);

 c:=0;
 b:=k;
 if k>1 then
  begin
  for a:=1 to n do
   begin
    b:=b-1;
     c:=c+b;
     b:=b-1;
     c:=c+b;
     if b<=1 then
     Break;
   end;
  end;

 Writeln(c);

end.

var k,n:int64;
begin
read (n,k);
if k>n div 2 then k:=n div 2;
write(  ((((n-1)+(n-k))*k) div 2)+(((k-1)*k)div 2)+((n-2*k)*k));
end.

var a,b,i,j,m,n,x,y:int64;
        q,w:array[0..101]of longint;
{procedure qs(l,r:longint);
begin
 i:=l;
 j:=r;
 x:=q[(l+r)div 2];
 repeat
  while q[i]<x do inc(i);
  while q[j]>x do dec(j);
  if i<=j then
  begin
   y:=q[i];
   q[i]:=q[j];
   q[j]:=y;
   y:=w[i];
   w[i]:=w[j];
   w[j]:=y;
   inc(i);
   dec(j);
  end;
 until i>j;
 if i<r then qs(i,r);
 if l<j then qs(l,j);
end; }
begin
 //assign(input,'input.txt');reset(input);
 //assign(output,'output.txt');rewrite(output);
 readln(n,m);
 if(n=1)or(m=0)then
  write(0)else
  begin
   if m>n div 2 then
    m:=n div 2;
   a:=(n-1+n-2*m)*m;
   write(a);
  end;
end.

const fi = '';
      fo = '';
var x, ans, k, j, n: int64;
    i: longint;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(n,k);
  j:=n+1;
  for i:=1 to n div 2 do
    begin
      dec(k);
      dec(j);
      ans:=ans+(j-i)+(j-i-1);
      if k = 0 then break;
    end;
  write(ans);

  close(input); close(output);
end.

program z1;
var a,b,c,d,i,j,k,l,m,n,mx:longint; Z,Q:array[1..100000] of longint; count:int64;

Function min(x,y:longint):longint;
begin
if x<y then min:=x else min:=y;
end;

Procedure swap(var x,y:longint);
var v:longint;
begin
v:=x; x:=y; y:=v;
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(n,k);
for i:=1 to n do
 begin
 Z[i]:=i; Q[n-i+1]:=i;
 end;
mx:=min(k,n>>1);

for i:=1 to mx do
swap(Z[i],Z[n-i+1]);

for i:=1 to n do
 begin
 if Z[i]=Q[i] then count:=count+n-i else count:=count+k;
 end;

if (n mod 2=1) and (n>1) then
 begin
 a:=(n div 2)+(n mod 2);
 if Z[a]<Z[a+1] then count:=count-n+a+k;
 end;
writeln(count);
end.

var
  i, n, k: longint;
  res: int64;

begin
  readln(n, k);
  if (k > n div 2) then
    k := n div 2;
  res := 0;
  for i := 1 to k do
    res := res + 1 + (n - 2 * i) * 2;
  writeln(res);
end.

var a:array[0..2000011] of int64;
    t1,t2,kol,n,k,i:int64;j:longint;
begin
readln(n,k);
t1:=1;
t2:=n;

while(n div 2>=i)and(k>0)do
begin
a[t1]:=1;
a[t2]:=1;
dec(k);
inc(t1);dec(t2);
inc(i);
end;

for j:=1 to i do
if a[j]<>0 then kol:=kol+n-j;

i:=j+1;    k:=0;

for j:=i to n do
if a[j]<>0 then kol:=kol+j-i;//k else
//if a[j]=0 then inc(k);

writeln(kol);

end.

var s1,s2,s3,s4:string;
i,n,k:int64;
begin
readln(n,k);
if k>= n div 2 then begin writeln(n*(n-1) div 2);exit; end;
writeln((2*n*k-k*k-k) div 2 + n*k-2*k*k+(k*k-k)div 2);
end.

uses math;
var   n,k,i:longint;
  p,ans,p1:int64;
 begin
  read(n,k);

 // for i:=1 to n do
   //a[i]:=1;
   p:=n-1;
   p1:=n-2;

   for i:=1 to min(n div 2,k) do
    begin
     inc(ans,p);
     dec(p,2);
     inc(ans,p1);
     dec(p1,2);
    end;
    writeln(ans);
 end.

Program main;
  Uses MATH;
  var n , k : LongInt;
       i : LongInt;
       med : LongInt;
       Ans : Int64;
begin
  Ans := 0 ;
  readLn ( n , k ) ;

  med := (n + 1 ) div 2 ;

  k := min ( med , k ) ;

  for i := 1 to n-1 do
  begin
    if ( i <= k ) then
      Ans := Ans + ( n - i )
    else
      Ans := Ans + min ( k , n-i ) ;
  end;

  writeLn ( Ans ) ;
end.

var
n,k,i:longint;
sum,q:int64;
begin
readln(n,k);
k:=k*2;
if k>n
then k:=n;
for i:=1 to k do begin
q:=n-i;
inc(sum,q);
end;
writeln(sum);
end.

var n,k,ans,n2,kol,s1,s2:int64;
begin
  readln(n,k);
  if k>=(n div 2) then begin
                         n:=n-1;
                         ans:=((1+n)*n) div 2;
                       end
                   else begin
                          s1:=(n-1)*k;
                          kol:=n-k*2;
                          s2:=k*kol;
                          ans:=s1+s2;
                        end;
  writeln(ans);

end.

const modulo = 222222;
var a, rsq : array[0 .. 822222] of longint;
    n, m, i, j, l, r : longint;
    answer : int64;

procedure swap(var t, y : longint);
var u : longint;
begin
 u := t; t := y; y := u;
end;

procedure replace(i, x : longint);
begin
 i := i + modulo - 1;
 rsq[i] := x;
 i := i div 2;
 while (i > 0) do
  begin
   rsq[i] := rsq[i + i] + rsq[i + i + 1];
   i := i div 2;
  end;
end;

function getsum(l, r : longint) : longint;
var i, j, ans : longint;
begin
 ans := 0;
 i := l + modulo - 1;
 j := r + modulo - 1;
 while (i <= j) do
  begin
   if odd(i) then ans := ans + rsq[i];
   if not odd(j) then ans := ans + rsq[j];
   i := (i + 1) div 2;
   j := (j - 1) div 2;
  end;
getsum := ans;
end;

begin
 readln(n, m);
 for i := 1 to n do a[i] := i;
 l := 1;
 r := n;
 while (l < r) and (m > 0) do
  begin
   swap(a[l], a[r]);
   l := l + 1;
   r := r - 1;
   m := m - 1;
  end;
 answer := 0;
 for i := 1 to n do
  begin
   replace(a[i], 1);
   answer := answer + int64(getsum(a[i] + 1, n));
  end;
 writeln(answer);
end.

var n,k,i,j,f,l,k1,k2:longint;
    ans:int64;
begin
readln(n,k); l:=0;
f:=n div 2;
k1:=n-1; k2:=n-2;
if k>f then k:=f;
for i:=1 to k do
begin
if k1>0 then inc(ans,k1+n-2*i);
dec(k1,2);
dec(k2);
end;
write(ans);
end.

var
    n, k: Int64;
    cnt: Int64;

begin
    Read (n, k);

    if k > n div 2 then
        k:= n div 2;

    cnt:= n * k - (1 + k) * k div 2 + (n - k * 2) * k + k * (k - 1) div 2;

    WriteLn (cnt)
end.

var
     N,K,i,j,ans:Int64;
begin
     Readln(N,K);
     i:=1;
     j:=N;
     ans:=0;
     while (K>0) and (i<j) do
begin
     ans:=(i*(i-1)) div 2+(i*(j-1+n-1)) div 2+i*(j-i-1);
     Inc(i);
     Dec(j);
     Dec(k);
 end;
     Writeln(ans);
 end.

const fni='';
      fno='';
var f:Text;
    n,k,d:longint;
    res,s,sk:int64;
{----------------------}
procedure doc;
begin
  assign(f,fni);
  reset(f);
  readln(f,n,k);
  close(f);
end;
{-----------------------}
procedure solve;
var tam,i:longint;
begin
  tam:=0;
  for i:=1 to k do
    begin
      s:=s+n-i;
      tam:=i;
      sk:=sk+i;
      if i=n div 2 then
        begin
          res:=s+sk-i+(n-2*(n div 2))*i;
          Writeln(f,res);
          close(f);
          halt;
        end;
    end;
  sk:=sk-tam;
  if n-2*k>0 then
    res:=res+(n-2*k)*k+sk+s
  else res:=s+sk;
end;
{-----------------------}
procedure ghi;
begin
  assign(f,fno);
  rewrite(f);
  solve;
  Writeln(f,res);
  close(f);
end;
{-----------------------}
begin
  doc;
  ghi;
end.

var
m: qword;
n,k,i,j,j1,l,t: longint;
a: array  of longint;
flag: integer;
begin
readln(n,k);
setLength(a,n+1);
m:=0;
//if (k>n/2) then k:=round(n/2+1);
for i:=1 to n do
    a[i]:=i;
j:=1;
j1:=n;
i:=1;
while ((i<=k)and(j<=n-1)and(j1>j)) do begin

   m:= m+2 * (j1 - j - 1) + 1;

    i:=i+1;
    j:=j+1;
    j1:=j1-1;
end;

writeln(m);
end.

var
  a, b, c, sum, k, i, l: int64;

begin
  readln(a, b);
  i := 1;
  k := a;
  l := a;
  sum := 0;
  while i <= b do begin
    if k - 1 > 0 then sum := sum + k - 1;
    if l - 2 > 0 then sum := sum + l - 2;
    k := k - 2;
    l := l - 2;
    inc(i);
  end;
  writeln(sum);
end.

var n,k:uint64;

function min(a,b:uint64):uint64;
begin
if a<b then min:=a
else min:=b;
end;

begin
read(n,k);
k:=min(n div 2,k);
writeln(2*k*(n-k)-k);
end.

var
i: integer;
n, k, res, count: int64;
begin
read(n, k);
if k >= n div 2 then begin writeln((n * (n - 1)) div 2); exit; end;
count:= n - 1 + n - 2;
res:= 0;
for i:= 1 to k do
begin
res:= res + count;
count:= count - 4;
end;
writeln(res);
end.

      {$APPTYPE CONSOLE}
const nn=3; besk=2000000000000000000;
   nnn=2000000;  eps=1e-11; modul=1000000007;
 type matr=array[1..3,1..3] of extended;
   mat=^matr;
 label 1,2,3,4;

var i1,j1,k,step,kt,ppp,god,day,mon,mask,i0,j0,i,j,start,finish:longint;
newdl,dloch,kol,shag,m,t,ii,jj,l,r,p,p3,pos,ll,bb,pp,tt,ot1,ot2,s,kold,n:int64;
def,xx,cc,q,t1,t2,p4,p1,p2,ot,dist1,vt,zap,ba,by,aa,ay,kk,centr,koef:int64;
flag2,flag1,flag:boolean;
ch1,ch2,ch:char;
str:array[-10..12000] of matr;
prob,ccc1,v,rr,h1,h2,h,r1,r2,aaa,bbb,ccc,hh,po,pt,doltek,dolpred:extended;
b1,a1,next,prev,x1,x2,y1,y2,d,och,newoch,f,x,y,fact,c,b,a,prost:array[-100000..1100000] of int64;
oldzan,oldmarked,zan: array[0..330006] of boolean;
gr:array[-1..1001,-1..1001] of boolean;
agor,aver,ssumgor,ssumver,sgor,sver,udd,dostl,dostr: array[-100..600,-100..600] of int64;
det,ott :double;
d3,d1,d2,dist,edin:matr;
ss,ss1,ss2:string;
dd:array[-21..2001,-2001..2001] of int64;
marked,dost,newdost:array[-10..700000] of boolean;
ssnew:array[-10..1000000] of char;
pole:array[-10..610,-10..600] of char;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

 function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function degg(p,deg:int64):int64; var pp,q:int64;
 begin if deg=0 then degg:=1 else begin   if odd(deg) then degg:=(degg(p,deg-1)*p) mod modul else
 begin q:=(degg(p,deg shr 1)) mod modul; degg:=(q*q) mod modul;   end; end;   end;

begin
 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }
   read(n,p);
   if p>=(n div 2) then begin write(n*(n-1) shr 1); goto 1;  end;
   ot:=0;
   for i:=1 to 2*p do begin ii:=i; ot:=ot+(n-ii); end;
   writeln(ot);

   1:          close(output);
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    q,c,res:int64;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    nt,ii,jj,n,m,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(q,c);
  if q<2*c then c:=q div 2;
  res:=0;
  for i:=1 to c do
    begin
    inc(res,2*q-3);
    dec(q,2);
    end;
  writeln(res);

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

const fi = '';
      fo = '';
var x, ans, k, j, n, i: longint;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(n,k);
  j:=n+1;
  for i:=1 to n div 2 do
    begin
      dec(k);
      dec(j);
      ans:=ans+(j-i)+(j-i-1);
      if k = 0 then break;
    end;
  write(ans);

  close(input); close(output);
end.

program z1;
var a,b,c,d,i,j,k,l,m,n,mx:longint; Z,Q:array[1..100000] of longint; count:int64;

Function min(x,y:longint):longint;
begin
if x<y then min:=x else min:=y;
end;

Procedure swap(var x,y:longint);
var v:longint;
begin
v:=x; x:=y; y:=v;
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(n,k);
for i:=1 to n do
 begin
 Z[i]:=i; Q[n-i+1]:=i;
 end;
mx:=min(k,n>>1);

for i:=1 to mx do
swap(Z[i],Z[n-i+1]);

for i:=1 to n do
 begin
 if Z[i]=Q[i] then count:=count+n-i else count:=count+k;
 end;
writeln(count);
end.

var a:array[0..200001] of longint;
    t1,t2,kol,n,k,i,j:longint;
begin
readln(n,k);
t1:=1;
t2:=n;

while(n div 2>=i)and(k>0)do
begin
a[t1]:=1;
a[t2]:=1;
dec(k);
inc(t1);dec(t2);
inc(i);
end;

for j:=1 to i do
if a[j]<>0 then kol:=kol+n-j;

i:=j+1;

for j:=i to n do
if a[j]<>0 then kol:=kol+(j-i);

writeln(kol);

end.

Program main;
  Uses MATH;
  var n , k : LongInt;
       i : LongInt;
       med : LongInt;
       Ans : Int64;
begin
  Ans := 0 ;
  readLn ( n , k ) ;

  med := (n + 1 ) div 2 ;

  k := min ( med , k ) ;

  for i := 1 to med do
  begin
    if ( i <= k ) then
      Ans := Ans + ( n - i )
    else
      Ans := Ans + ( n - k );
  end;

  writeLn ( Ans ) ;
end.

var n,k,ans:int64;
begin
  readln(n,k);
  if k>=(n div 2) then begin
                         n:=n-1;
                         ans:=((1+n)*n) div 2;
                       end
                   else ans:=n*k;

  writeln(ans);

end.

var n,k,i,j,f,l,k1,k2:longint;
    ans:int64;
begin
readln(n,k); l:=0;
f:=n div 2;
k1:=n-1; k2:=n-2;
if k>f then k:=f;
for i:=1 to k do
begin
if k1>0 then inc(ans,k1+k1 div 2);
dec(k1);
dec(k2);
end;
write(ans);
end.

var
     N,K,i,j,ans:Int64;
begin
     Readln(N,K);
     i:=1;
     j:=N;
     ans:=0;
     while (K>0) and (i<j) do
begin
     ans:=(i*(1+i)) div 2+(i*(j-1+n-1)) div 2;
     Inc(i);
     Dec(j);
     Dec(k);
 end;
     Writeln(ans);
 end.

const fni='';
      fno='';
var f:Text;
    n,k,d,s,sk:longint;
    res:int64;
{----------------------}
procedure doc;
begin
  assign(f,fni);
  reset(f);
  readln(f,n,k);
  close(f);
end;
{-----------------------}
procedure solve;
var tam,i:longint;
begin
  tam:=0;
  for i:=1 to k do
    begin
      if i>n div 2 then break;
      s:=s+n-i;
      tam:=i;
      sk:=sk+i;
    end;
  sk:=sk-tam;
  if n-2*k>0 then
    res:=res+(n-2*k)*k+sk+s
  else res:=s+sk;
end;
{-----------------------}
procedure ghi;
begin
  assign(f,fno);
  rewrite(f);
  Writeln(f,res);
  close(f);
end;
{-----------------------}
begin
  doc;
  solve;
  ghi;
end.

const fni='';
      fno='';
var f:Text;
    n,k,d:longint;
    res,s,sk:int64;
{----------------------}
procedure doc;
begin
  assign(f,fni);
  reset(f);
  readln(f,n,k);
  close(f);
end;
{-----------------------}
procedure solve;
var tam,i:longint;
begin
  tam:=0;
  for i:=1 to k do
    begin
      if i>n div 2 then break;
      s:=s+n-i;
      tam:=i;
      sk:=sk+i;
    end;
  sk:=sk-tam;
  if n-2*k>0 then
    res:=res+(n-2*k)*k+sk+s
  else res:=s+sk;
end;
{-----------------------}
procedure ghi;
begin
  assign(f,fno);
  rewrite(f);
  Writeln(f,res);
  close(f);
end;
{-----------------------}
begin
  doc;
  solve;
  ghi;
end.

const fni='';
      fno='';
var f:Text;
    n,k,d,s,sk,res:longint;
{----------------------}
procedure doc;
begin
  assign(f,fni);
  reset(f);
  readln(f,n,k);
  close(f);
end;
{-----------------------}
procedure solve;
var tam,i:longint;
begin
  tam:=0;
  for i:=1 to k do
    begin
      if i>n div 2 then break;
      s:=s+n-i;
      tam:=i;
      sk:=sk+i;
    end;
  sk:=sk-tam;
  if n-2*k>0 then
    res:=res+(n-2*k)*k+sk+s
  else res:=s+sk;
end;
{-----------------------}
procedure ghi;
begin
  assign(f,fno);
  rewrite(f);
  Writeln(f,res);
  close(f);
end;
{-----------------------}
begin
  doc;
  solve;
  ghi;
end.

var n,k:integer;

function min(a,b:integer):integer;
begin
if a<b then min:=a
else min:=b;
end;

begin
read(n,k);
k:=min(n div 2,k);
writeln(2*k*(n-k)-k);
end.

var
i: integer;
n, k, res, count: int64;
begin
read(n, k);
if k >= n div 2 then begin writeln((n * (n - 1)) div 2); exit; end;
count:= n - 1 + n - 2;
res:= 0;
for i:= 1 to k do
begin
res:= res + count;
count:= count - 2;
end;
writeln(res);
end.