#define_CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<iostream>#include<cstring>#include<algorithm>#include<map>#include<vector>#include<math.h>#include<queue>usingnamespace std;typedeflonglong ll;typedefdouble dd;typedef pair<int,int> pii;typedef pair<dd, dd> pdd;constint MAXN =100010;constint MAXM =10;constint inf =1e9+7;const dd eps =1e-9;const dd pi =acos(-1);intmain(){int T;
cin >> T;while(T--){double w, d;
cin >> w >> d;double a =min(w, d), b =sqrt(w * w + d * d);
ll ans =0;for(ll x =0; x <=100&& a * x <= pi; x++)
ans =max(ans,2* x +3*(ll)(((pi - x * a)/ b)));for(ll y =0; y <=100&& b * y <= pi; y++)
ans =max(ans,2*(ll)((pi - y * b)/ a)+3* y);
cout << ans +4<< endl;}}