#include<bits/stdc++.h>
using namespace std;
struct Data
{
int year;
int month;
int day;
};
int main()
{
Data data;
while(scanf("%d%d%d",&data.year,&data.month,&data.day)!=EOF)
{
int days = 0;
int monthdays[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if(data.year<1)
{
printf("Input error!\n");
continue;
}
else if(data.month<1||data.month>12)
{
printf("Input error!\n");
continue;
}
else if(data.month==1||data.month==3||data.month==5||data.month==7||data.month==8||data.month==10||data.month==12)
{
if(data.day<1||data.day>31)
{
printf("Input error!\n");
continue;
}
}
else if(data.month==4||data.month==6||data.month==9||data.month==11)
{
if(data.day<1||data.day>30)
{
printf("Input error!\n");
continue;
}
}
else
{
if ((data.year % 4 == 0 && data.year % 100 != 0) || (data.year % 400 == 0))
{
monthdays[2] = 29;
if(data.month>=2&&(data.day>=30||data.day<=0))
{
printf("Input error!\n");
continue;
}
}
else
{
if(data.month>=2&&(data.day>=29||data.day<=0))
{
printf("Input error!\n");
continue;
}
}
}
for (int i = 1; i < data.month; i++)
{
if ((data.year % 4 == 0 && data.year % 100 != 0) || (data.year % 400 == 0))
{
monthdays[2] = 29;
}
days += monthdays[i];
}
days += data.day;
printf("%d\n",days);
}
return 0;
}