let str
while(str = readline()){
let date = str.replace(/ /, '-')
console.log((Date.parse(date) - Date.parse(date.substring(0, 4) + '-01-01')) / 86400000 + 1)
}
let str
while(str = readline()){
let date = str.replace(/ /, '-')
console.log((Date.parse(date) - Date.parse(date.substring(0, 4) + '-01-01')) / 86400000 + 1)
}