#include <stdio.h>

int main() 
{
    int year=0;
    int month=0;
    int day=0;
    scanf("%d %d %d",&year,&month,&day);
    int months[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
    if((year%4==0&&year%100!=0)||(year%400==0))
    {
        months[1]=29;
    }
    int i=0;
    int days=0;
    for(i=0;i<month-1;i++)
    {
        days+=months[i];
    }
    printf("%d\n",days+day);

    return 0;
}