import java.util.*;
import java.time.*;

//日期操作全用java time包
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        
        while(sc.hasNextInt()){
            int year=sc.nextInt();
            int month=sc.nextInt();
            int day=sc.nextInt();
            
            //Calendar c=Calendar.getInstance();
            //c.set(year,month-1,day);
            //System.out.println(c.get(Calendar.DAY_OF_YEAR));
            
            LocalDate ld=LocalDate.of(year,month,day);
            System.out.println(ld.getDayOfYear());
        }
    }
}