/*
Vishal Raj
Indian Institute of Technology Kharagpur
*/
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define FOR(i,l,r) for( int i = l-(l>r); i != r-(l>r); i += 1-2*(l>r) )
#define pb push_back
#define all(X) (X).begin(),(X).end()
#define xx first
#define yy second
#define ii pair<int,int>
#define vii vector<ii>
int ans = 0;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Rand( int a, int b ) {
return a + rng()%(b-a);
}
void solve() {
vi v(12,0);
int qq = 0;
vi qu(8,-1);
vi se(4,-1);
vi fi(2,-1);
FOR(i,0,4) {
int k = i*3;
FOR(j,k,k+3) {
int l = j+1;
if( l == k+3 ) l = k;
if( rng()%2 ) {
v[l]++;
} else {
v[j]++;
}
}
vii u(3,{0,0});
FOR(j,0,3) u[j] = {v[k+j],k+j};
sort(all(u));
int out = 0;
if( u[0].xx == u.back().xx ) {
out = rng()%3;
}
FOR(j,0,3) {
if( j != out ) {
qu[qq++] = u[j].yy;
}
}
}
qq = 0;
FOR(i,0,4) {
int k = i*2;
if( rng()%2 ) {
v[qu[k+1]]++;
se[qq++] = qu[k+1];
} else {
v[qu[k]]++;
se[qq++] = qu[k];
}
}
qq = 0;
FOR(i,0,2) {
int k = i*2;
if( rng()%2 ) {
fi[qq++] = se[k+1];
v[se[k+1]]++;
} else {
fi[qq++] = se[k];
v[se[k]]++;
}
}
qq = 0;
if( rng()%2 ) {
v[fi[1]]++;
ans += v[fi[1]];
} else {
v[fi[0]]++;
ans += v[fi[0]];
}
}
int main() {
int times; cin>>times;
FOR(i,0,times) solve();
cout<<ans*1.0/times*1.0<<"\n";
return 0;
}
LyoKCVZpc2hhbCBSYWoKCUluZGlhbiBJbnN0aXR1dGUgb2YgVGVjaG5vbG9neSBLaGFyYWdwdXIKKi8KI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSB2aSB2ZWN0b3I8aW50PgojZGVmaW5lIEZPUihpLGwscikgZm9yKCBpbnQgaSA9IGwtKGw+cik7IGkgIT0gci0obD5yKTsgaSArPSAxLTIqKGw+cikgKQojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIGFsbChYKSAoWCkuYmVnaW4oKSwoWCkuZW5kKCkKI2RlZmluZSB4eCBmaXJzdAojZGVmaW5lIHl5IHNlY29uZAojZGVmaW5lIGlpIHBhaXI8aW50LGludD4KI2RlZmluZSB2aWkgdmVjdG9yPGlpPgoKaW50IGFucyA9IDA7Cm10MTk5Mzcgcm5nKGNocm9ubzo6c3RlYWR5X2Nsb2NrOjpub3coKS50aW1lX3NpbmNlX2Vwb2NoKCkuY291bnQoKSk7CgppbnQgUmFuZCggaW50IGEsIGludCBiICkgewogICAgcmV0dXJuIGEgKyBybmcoKSUoYi1hKTsKfQoKdm9pZCBzb2x2ZSgpIHsKICAgIHZpIHYoMTIsMCk7CiAgICBpbnQgcXEgPSAwOwogICAgdmkgcXUoOCwtMSk7CiAgICB2aSBzZSg0LC0xKTsKICAgIHZpIGZpKDIsLTEpOwogICAgRk9SKGksMCw0KSB7CiAgICAgICAgaW50IGsgPSBpKjM7CiAgICAgICAgRk9SKGosayxrKzMpIHsKICAgICAgICAgICAgaW50IGwgPSBqKzE7CiAgICAgICAgICAgIGlmKCBsID09IGsrMyApIGwgPSBrOwogICAgICAgICAgICBpZiggcm5nKCklMiApIHsKICAgICAgICAgICAgICAgIHZbbF0rKzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHZbal0rKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2aWkgdSgzLHswLDB9KTsKICAgICAgICBGT1IoaiwwLDMpIHVbal0gPSB7dltrK2pdLGsran07CiAgICAgICAgc29ydChhbGwodSkpOwogICAgICAgIGludCBvdXQgPSAwOwogICAgICAgIGlmKCB1WzBdLnh4ID09IHUuYmFjaygpLnh4ICkgewogICAgICAgICAgICBvdXQgPSBybmcoKSUzOwogICAgICAgIH0gCiAgICAgICAgRk9SKGosMCwzKSB7CiAgICAgICAgICAgIGlmKCBqICE9IG91dCApIHsKICAgICAgICAgICAgICAgIHF1W3FxKytdID0gdVtqXS55eTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHFxID0gMDsKICAgIEZPUihpLDAsNCkgewogICAgICAgIGludCBrID0gaSoyOwogICAgICAgIGlmKCBybmcoKSUyICkgewogICAgICAgICAgICB2W3F1W2srMV1dKys7CiAgICAgICAgICAgIHNlW3FxKytdID0gcXVbaysxXTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2W3F1W2tdXSsrOwogICAgICAgICAgICBzZVtxcSsrXSA9IHF1W2tdOwogICAgICAgIH0KICAgIH0KICAgIHFxID0gMDsKICAgIEZPUihpLDAsMikgewogICAgICAgIGludCBrID0gaSoyOwogICAgICAgIGlmKCBybmcoKSUyICkgewogICAgICAgICAgICBmaVtxcSsrXSA9IHNlW2srMV07CiAgICAgICAgICAgIHZbc2VbaysxXV0rKzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBmaVtxcSsrXSA9IHNlW2tdOwogICAgICAgICAgICB2W3NlW2tdXSsrOwogICAgICAgIH0KICAgIH0KICAgIHFxID0gMDsKICAgIGlmKCBybmcoKSUyICkgewogICAgICAgIHZbZmlbMV1dKys7CiAgICAgICAgYW5zICs9IHZbZmlbMV1dOwogICAgfSBlbHNlIHsKICAgICAgICB2W2ZpWzBdXSsrOwogICAgICAgIGFucyArPSB2W2ZpWzBdXTsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBpbnQgdGltZXM7IGNpbj4+dGltZXM7CiAgICBGT1IoaSwwLHRpbWVzKSBzb2x2ZSgpOwogICAgY291dDw8YW5zKjEuMC90aW1lcyoxLjA8PCJcbiI7CiAgICByZXR1cm4gMDsKfQ==