#include <stdio.h>

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