#include<stdio.h>
int main()
{
int a[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}},y,m,d,sum=0;
scanf("%d/%d/%d",&y,&m,&d);
if(y%40&&y%100!=0||y%4000){
for(int i=0;i<m;i++){
sum=sum+a[1][i];
}
sum=sum+d;
}
else {
for(int i=0;i<m;i++){
sum=sum+a[0][i];
}
sum=sum+d;
}
printf("%d",sum);
return 0;
}
// 2000/08/09这个日期,scanf可以用/间隔