#include <stdio.h>
int day_of_year(int y,int m,int d)
{
int k,leap,s;
int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
leap = (y%4==0&&y%100!=0)||(y%400==0);
s = d;
for(k=1;k<m;k++)
{
s+=days[k];
}
if(leap==1&&m>2)
s+=1;
return s;
}
int main()
{
int year,month,day;
while(scanf("%d/%d/%d",&year,&month,&day)!=EOF)
{
printf("%d\n",day_of_year(year,month,day));
}
return 0;
}