#include<bits/stdc++.h>
using namespace std;
int month_day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool judge(int x){
if(x%400==0) return true;
else if(x%4==0&&x%100!=0) return true;
else return false;
}
int day(int x,int y,int z){
int res = 0;
if(judge(x)) month_day[2]=29;//is run
for(int i=1;i<y;i++){
res+=month_day[i];
}
res+=z;
month_day[2]=28;
return res;
}
int main(){
int m;cin>>m;
for(int i=0;i<m;i++){
int x,y,z; cin>>x>>y>>z;
cout<<day(x,y,z)<<'\n';
}
}

京公网安备 11010502036488号