#include <stdio.h>
int main()
{
int a,b,c;
while(scanf("%d/%d/%d",&a,&b,&c)!=EOF)
{
int s,i;
int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int n[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if((a%4==0&&a%100!=0)||(a%400==0))
{
s=0;
for(i=0;i<b-1;i++)
s=s+m[i];
s=s+c;
}
else
{
s=0;
for(i=0;i<b-1;i++)
s=s+n[i];
s=s+c;
}
printf("%d\n",s);
}
return 0;
}
int main()
{
int a,b,c;
while(scanf("%d/%d/%d",&a,&b,&c)!=EOF)
{
int s,i;
int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int n[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if((a%4==0&&a%100!=0)||(a%400==0))
{
s=0;
for(i=0;i<b-1;i++)
s=s+m[i];
s=s+c;
}
else
{
s=0;
for(i=0;i<b-1;i++)
s=s+n[i];
s=s+c;
}
printf("%d\n",s);
}
return 0;
}