#include <iostream> using namespace std; int IsLeapY(int y){ if(y%400==0 || (y%4==0 && y%100!=0)) return 1; else return 0; } int day[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}}; int main() { int y,m,d; while(cin>>y>>m>>d){ int f=IsLeapY(y); int num=0; for(int i=1;i<m;i++){ num+=day[f][i]; } num+=d; cout<<num<<endl; } }