#include<stdio.h>
int main()
{
int year = 0, month = 0, day = 0, sum = 0;
scanf("%d/%d/%d", &year, &month, &day);
switch (month)
{
case(12):
sum = day + 30;
case(11):
sum = day + 31;
case(10):
sum = day + 30;
case(9):
sum = day + 31;
case(8):
sum = day + 31;
case(7):
sum = day + 30;
case(6):
sum = day + 31;
case(5):
sum = day + 30;
case(4):
sum = day + 31;
case(3):
{
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
sum = day + 29;
else
sum = day + 28;
}
case(2):
sum = day + 31;
case(1):
printf("%d", sum);

}
return 0;
}