#include<cstdio>
using namespace std;
int dayTable[2][13]= {
{0,31,28,31,30,31,30,31,31,30,31,30,31}, //平年每月天数
{0,31,29,31,30,31,30,31,31,30,31,30,31} //闰年每月天数
};
//定义函数判断是否为闰年
bool IsLeapYear(int year){
if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0){
return true;
}
return false;
}
int main(){
int year,month,day;
while(scanf("%d%d%d",&year,&month,&day) != EOF){
int number = 0; //定义变量,保存天数
int row = IsLeapYear(year); //返回true等价于返回1,dayTable[1]对应于闰年中的每月天数,返回false等价于返回0
for(int i = 0; i < month; ++i){ //进行天数的累加即可
number += dayTable[row][i];
}
number += day;
printf("%d\n",number);
}
return 0;
}