import java.util.Scanner;
public class d466 {
static int a[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
static int b[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
public static void main(String[] args){
Scanner input=new Scanner(System.in);
while(input.hasNext()){
int year=input.nextInt();
int month=input.nextInt();
int day=input.nextInt();
String d=day==1?"day":"days";
boolean n=isLeap(year);
int total=plus(year,month)+day;
if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day<=31){
System.out.printf("It is %d %s in %d\n",total,d,year);
}else if((month==4||month==6||month==9||month==11)&&day<=30){
System.out.printf("It is %d %s in %d\n",total,d,year);
}else if(month==2){
if(n==true){
if(day<=29&&day>=1)
System.out.printf("It is %d %s in %d\n",total,d,year);
}else if(day<=28&&day>=1){
System.out.printf("It is %d %s in %d\n",total,d,year);
}else{
System.out.println("Error");
}
}else{
System.out.println("Error");
}
}
}
static int plus(int year,int month){
int total=0;
boolean l=isLeap(year);
for(int i=0;i<(month);i++ ){
total=l==true?(a[i]+total):(b[i]+total);
}
return total;
}
static boolean isLeap(int year){
boolean isLeap=false;
if(year%4==0&&year%100!=0||year%400==0&&year>=1)
isLeap=true;
return isLeap;
}
}
/*
與正確輸出不相符(line:8)
您的答案為: It is 30 d ...略
正確答案為: Error
*/