#include<stdio.h>
int main()
{
int year,month;
int day[12]= {31,28,31,30,31,30,31,31,30,31,30,31};
do
{
scanf("%d,%d",&year,&month);
}
while(month<1||month>12); // 输入不对一直输入
if((month==2)&&(year%4==0&&year%100!=0||year%400==0)) printf("%d,%d,%d",year,month,day[month-1]+1);
else printf("%d,%d,%d",year,month,day[month-1]);
return 0;
}