#include #include #include #include using namespace std; int main() { int K; while (cin>>K) { timeval tv; gettimeofday(&tv, 0); double res=0; int cnt=0; while (true) { int c=0, k=0; while (k!=K) { k+=rand()%6+1; if (k>K) k=0; ++c; } res+=c; ++cnt; if (cnt%100==0) { timeval tv2; gettimeofday(&tv2, 0); if ((tv2.tv_sec-tv.tv_sec)*1e6+tv2.tv_usec-tv.tv_usec>4e6) break; } } printf("%.3f\n", res/cnt); } }