闰年的计算方法:整百的年份除以400余0则为闰年,不是整百的年份除以4余0则为闰年
let arr = readline().split(' ');
let dic = [31,28,31,30,31,30,31,31,30,31,30,31];
Number(arr[0])%100===0?Number(arr[0])%400===0?dic[1]=29:'':Number(arr[0])%4===0?dic[1]=29:'';
let count = 0;
for(let i=0;i<Number(arr[1])-1;i++){
count+=dic[i]
}
console.log(count+Number(arr[2]))