#include <iostream>
#include <time.h>
#include <math.h>
int main(){
    int y,m,d;
    while(scanf("%d %d %d",&y,&m,&d)==3){
        struct tm d1 = {0,0,0,d,m-1,y-1900};
        struct tm d2 = {0,0,0,1,0,y-1900};
        time_t ds1 = mktime(&d1);
        time_t ds2 = mktime(&d2);
        double gap = difftime(ds1,ds2);
        int days = (int)ceil(gap/(60*60*24))+1;
        printf("%d\n",days);
    }
    return 0;
}