#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // NOLINT void dfs(int32_t sum, int32_t c, unordered_map &hist) { if (c == 0) { ++hist[sum]; return; } for (auto i = 1; i <= 6; ++i) { dfs(sum + i, c - 1, hist); } } void dfs2(int32_t sum, int32_t c, int32_t d, unordered_map &hist) { if (c == 0) { dfs(sum, d, hist); return; } for (auto i = 4; i <= 6; ++i) { dfs2(sum + i, c - 1, d, hist); dfs2(sum + i, c - 1, d, hist); } } int main() { int32_t n, k; cin >> n >> k; unordered_map hist1, hist2; dfs(0, n, hist1); dfs2(0, k, n - k, hist2); int64_t sum = 0, win = 0; for (auto [k2, v2] : hist2) { for (auto [k1, v1] : hist1) { sum += int64_t(v1) * v2; if (k2 > k1) win += int64_t(v1) * v2; } } printf("%.6f\n", double(win) / sum); return 0; }