#include<stdio.h>
int main(){
int n,y,d,s;
scanf("%d %d %d",&n,&y,&d);
s=d;
switch(y-1){
case 11:s=s+30;
case 10:s=s+31;
case 9:s=s+30;
case 8:s=s+31;
case 7:s=s+31;
case 6:s=s+30;
case 5:s=s+31;
case 4:s=s+30;
case 3:s=s+31;
case 2:
if((n%4==0&&n%100!=0)||(n%400==0)) s=s+29;
else s=s+28;
case 1:s=s+31;
}
printf("%d",s);
}
#include<stdio.h>
int main(){
int n,y,d,s;
scanf("%d %d %d",&n,&y,&d);
s=d;
switch(y-1){
case 11:s=s+30;
case 10:s=s+31;
case 9:s=s+30;
case 8:s=s+31;
case 7:s=s+31;
case 6:s=s+30;
case 5:s=s+31;
case 4:s=s+30;
case 3:s=s+31;
case 2:
if((n%4==0&&n%100!=0)||(n%400==0)) s=s+29;
else s=s+28;
case 1:s=s+31;
}
printf("%d",s);
}