#include #define rep(i,a,b) for(int i=int(a);i> N >> K; double dp1[N+1][70],dp2[N+1][70]; rep(i,0,N+1)rep(j,0,61)dp1[i][j] = dp2[i][j] = 0; dp1[0][0] = 1; dp2[0][0] = 1; rep(i,0,N)rep(j,0,60)rep(k,1,7){ dp1[i+1][j + k] += dp1[i][j] / 6; } rep(i,0,61)dp2[N-K][i] = dp1[N-K][i]; rep(i,N-K,N+K)rep(j,0,60)rep(k,4,7){ dp2[i+1][j + k] += dp2[i][j] / 3; } double ans = 0; rep(i,0,61)rep(j,i+1,61){ ans += dp2[N][j] * dp1[N][i]; } cout << ans << endl; }