#include using namespace std; const int MAXN = 10; int N, K; double dp1[MAXN + 1][MAXN * 6 + 1]; double dp2[MAXN + 1][MAXN * 6 + 1]; double p1[MAXN * 6 + 1]; int main() { cin >> N >> K; dp1[0][0] = 1.0; for (int i = 0; i < N; i++) { for (int j = 1; j <= 6; j++) { for (int k = 0; k <= 6 * i; k++) { dp1[i + 1][k + j] += dp1[i][k] / 6.0; } } } for (int i = 0; i <= 6 * (N - K); i++) { dp2[N - K][i] = dp1[N - K][i]; } for (int i = N - K; i < N; i++) { for (int j = 4; j <= 6; j++) { for (int k = 0; k <= 6 * i; k++) { dp2[i + 1][k + j] += dp2[i][k] / 3.0; } } } for (int i = N; i <= 6 * N; i++) { p1[i] = p1[i - 1] + dp1[N][i]; } double win = 0.0; for (int i = N; i <= 6 * N; i++) { win += dp2[N][i] * p1[i - 1]; } cout << win << endl; return 0; }