#include using namespace std; typedef long long LL; #define F(N,S,T) for(int N=(S);N<=(T);N++) int ceil(int x,int y){ return (x+y-1)/y; } typedef pair P; int pk(P &x,P &y,int lim=INT_MAX){ if(x.second<=0||y.second<=0)return 0; int t=min(lim,min(ceil(y.second,x.first),ceil(x.second,y.first))); x.second-=t*y.first; y.second-=t*x.first; return t; } int calc(P x,P y,P z,int l1){ int t=0; t+=pk(x,y,l1); t+=pk(x,z); t+=pk(y,z); if(((x.second>0?1:0)+(y.second>0?1:0)+(z.second>0?1:0))>1)return INT_MAX; return t; } void work(){ P s[3]; F(i,0,2)cin>>s[i].first; F(i,0,2)s[i].second=1000; int ans=INT_MAX; F(i,0,1000){ sort(s,s+3); do{ ans=min(ans,calc(s[0],s[1],s[2],i)); } while(next_permutation(s,s+3)); } cout<>t; while(t--){ work(); } return 0; }