#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; #define MOD 1000000007 // 10^9 + 7 #define INF 1000000000 // 10^9 #define LLINF 1LL<<60 double dp1[11][61]; // dp1[i][j] : サイコロをi回投げて合計がjになる確率 double dp2[11][61]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; for (int i = 0; i < N; i++) { for (int j = 0; j <= 60; j++) { dp1[i][j] = 0; dp2[i][j] = 0; } } dp1[0][0] = 1; dp2[0][0] = 1; for (int i = 0; i < N; i++) { for (int j = 0; j <= 60; j++) { if (i <= K - 1) { if (dp1[i][j]) { for (int k = 4; k <= 6 && j + k <= 60; k++) dp1[i + 1][j + k] += (dp1[i][j] / 3); } } else { if (dp1[i][j]) { for (int k = 1; k <= 6 && j + k <= 60; k++) dp1[i + 1][j + k] += (dp1[i][j] / 6); } } if (dp2[i][j]) { for (int k = 1; k <= 6 && j + k <= 60; k++) dp2[i + 1][j + k] += (dp2[i][j] / 6); } } } vector V; V.push_back(0); // V[i] : 次郎君のN個の和がi以下になる確率 for (int i = 1; i <= 60; i++) V.push_back(V[i - 1] + dp2[N][i]); double ans = 0; for (int i = 1; i <= 60; i++) { ans += dp1[N][i] * V[i - 1]; } cout << ans << endl; // for (int i = 0; i <= 60; i++) cout << V[i] << " "; return 0; }