#include #define eps 1e-8 using namespace std; const int E=10000000; const int R=E*4; typedef double db; int _,a[4],p[4],ans; db x[4],y[4]; int dis(int x,int y){ y=(y%R+R)%R; if (x> _; while (_--){ for (int i=0;i<4;i++) cin >> x[i] >> y[i]; for (int i=0;i<4;i++){ if (abs(x[i])=E&&a[p[0]]<=E*2&&a[p[1]]>=E*3&&(a[p[1]]<=E*4||a[p[1]]==0)){ ret=0; ret+=dis(a[p[2]],E-a[p[0]]); ret+=dis(a[p[3]],E-a[p[1]]); ans=min(ans,ret); } else if (a[p[0]]>=0&&a[p[0]]<=E&&a[p[1]]>=E*2&&a[p[1]]<=E*3) { ret=0; ret+=dis(a[p[2]],E*3-a[p[0]]); ret+=dis(a[p[3]],E*3-a[p[1]]); ans=min(ans,ret); } */ }while (next_permutation(p,p+4)); printf("%.12f\n",(double)ans/E); } }