#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) #define CLR(mat) memset(mat, 0, sizeof(mat)) typedef long long ll; int main() { int N, K; cin >> N >> K; double dp1[N+1][6*N+1], dp2[N+1][6*N+1]; CLR(dp1); CLR(dp2); dp1[0][0] = dp2[0][0] = 1.0; // 二郎 FOR(i,0,N) { FOR(j,0,6*N+1) { FOR(m,1,7) { if(j+m<=6*N) dp1[i+1][j+m] += dp1[i][j] / 6; } } } FOR(i,0,N) { FOR(j,0,6*N+1) { if(i+1 > K) { FOR(m,1,7) { if(j+m<=6*N) dp2[i+1][j+m] += dp2[i][j] / 6; } } else { FOR(m,4,7) { if(j+m<=6*N) dp2[i+1][j+m] += dp2[i][j] / 3; } } } } double ans = 0; FOR(i,0,6*N+1) FOR(j,0,i) ans += dp2[N][i] * dp1[N][j]; printf("%.10lf\n", ans); return 0; }