import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = in.readLine(); int[] days_month = {0,31,28,31,30,31,30,31,31,30,31,30,31}; // int[] total = new int[12]; for(int i = 1;i < 13;i++){ days_month[i] += days_month[i - 1]; } String[] str1 = str.split(" "); int year = Integer.parseInt(str1[0]); int month = Integer.parseInt(str1[1]); int day = Integer.parseInt(str1[2]); int flag = 0; if(year % 4 == 0 ){ flag = 1; if(year % 100 == 0){ if(year % 400 == 0); else flag = 0; } } if(month > 2){ System.out.println(days_month[month -1] + day + flag); }else{ System.out.println(days_month[month -1] + day); }

}

}