#include <iostream> using namespace std; int main() { int year,mon,day; while(cin>>year>>mon>>day) { int sum=0; if(mon==1) { cout<<day<<endl; } else { sum=(mon-1)*30; if(mon==2) cout<<sum+1+day<<endl; if(mon==3) { if(year%4==0) cout<<sum-1+day<<endl; else cout<<sum-1+day<<endl; } if(mon==4||mon==5) { if(year%4==0) cout<<sum+1+day<<endl; else cout<<sum+day<<endl; } if(mon==6||mon==7) { if(year%4==0) cout<<sum+2+day<<endl; else cout<<sum+1+day<<endl; } if(mon==8) { if(year%4==0) cout<<sum+3+day<<endl; else cout<<sum+2+day<<endl; } if(mon==9||mon==10) { if(year%4==0) cout<<sum+4+day<<endl; else cout<<sum+3+day<<endl; } if(mon==11||mon==12) { if(year%4==0) cout<<sum+5+day<<endl; else cout<<sum+4+day<<endl; } } } return 0; }