const
 months:array [1..12] of integer=(31,28,31,30,31,30,31,31,30,31,30,31);
 
var
  d,m,y:integer; 
   f,g:text;
 begin
   assign(f,'input.txt');
  assign(g,'output.txt');
  reset(f);
  rewrite(g);
  readln(f,d,m,y);
  
  if (d=31) and (m=12) then begin d:=1; m:=1; y:=y+1 end
     else
       if (m=2) then
           if (y mod 400=0) or (y mod 4 =0) and (y mod 100<>0) then
                             if d=29 then begin d:=1; m:=3; end
                                     else d:=d+1
           else              if d=28 then begin d:=1; m:=3; end
                                     else d:=d+1
      else
         if d=months[m] then begin d:=1; m:=m+1; end
                                     else d:=d+1;
        
  if d<10 then write(g,0);
  write(g,d,'.');
  if m<9 then write(g,0);
  write(g,m,'.',y);
  
  
  
   close(f);
  close(g);

 end.